Skip to main content
It includes @photon-rx/core, the JavaScript client, so you don’t install that separately. ⚠️ Not published to npm yet.
The cards have no page chrome: no header, no fixed bars, no viewport breakpoints. They size to their container, so they fit a page, a dialog or a side panel.

PhotonProvider

Wrap the cards in one provider. It signs the prescriber in and gives every card inside it a client. Providers can nest. A nested provider inherits what it doesn’t set, and providers with the same clientId share one sign-in.

Signing in

On load, the provider signs in by itself when it can: it finishes a sign-in returning from Photon, or renews a stored session. It never redirects on its own. Otherwise, the first card on the page shows Sign in to Photon, and the prescriber clicks it. Inside an iframe, sign-in opens a popup. The cards don’t offer sign-out. Your app can sign out with usePhoton().session.signOut(). useSession() gives your own chrome the prescriber’s name, email and organization.
The session is stored in your page’s localStorage, so treat any script injection on that page as a token leak. Moving it out of localStorage is on our roadmap.

PhotonOrder

The patient, a card for each prescription, then Send. Send appears once the patient is found, every prescription is signed, and everything is saved. Without prescriptions, the order starts with one empty line. Add another prescription starts from the same template as the first line.

PhotonPatient

Find or add a patient, then edit them. Each field the prescriber fills in is synced, and Photon decides whether that’s a match, a list of candidates, or a new patient.

PhotonPrescription

One prescription: the drug, sig and dispense, screening, and Sign. A signed prescription is final.

Events

Every event gets the live object. obj.id is the record’s id, and obj.state is the record itself, with the same fields as the API. Events fire when Photon has a record and when that record changes. They don’t fire while a save is in flight.

Live objects as props

Any record prop also takes a live object from the JavaScript client. The card uses it as is and doesn’t fetch it again, and anything else holding the same object sees every change.