Build / Molecules
RsvpControl
Tri-state RSVP for an event, with the running tally kept alongside it.
Built on ChoiceGroup rather than duplicating its selection behavior —
the icons live in the option label, and the tally is the one thing a
plain choice group doesn't carry.
import { RsvpControl } from '@meetcard/deck'Example
<RsvpControl value={status} onChange={setStatus} counts={{ yes: 12, maybe: 3, no: 1 }} />Stories
Source
const Default = args => {
const [value, setValue] = useState<RsvpStatus | undefined>(args.value)
return <RsvpControl counts={{ yes: 12, maybe: 3, no: 1 }} value={value} onChange={setValue} />;
};Answered yes. The count includes you.
Source
const Attending = args => {
const [value, setValue] = useState<RsvpStatus | undefined>(args.value)
return <RsvpControl counts={{ yes: 12, maybe: 3, no: 1 }} value={value} onChange={setValue} />;
};Nobody has answered yet — the counts read zero rather than disappearing.
Source
const NoResponsesYet = args => {
const [value, setValue] = useState<RsvpStatus | undefined>(args.value)
return <RsvpControl counts={{ yes: 0, maybe: 0, no: 0 }} value={value} onChange={setValue} />;
};Props
| Prop | Type | Default | Description |
|---|---|---|---|
countsrequired | RsvpCounts | — | Tallies shown below the control. |
className | string | — | — |
label | string | 'Are you attending?' | — |
name | string | — | — |
onChange | (status: RsvpStatus) => void | — | — |
value | 'yes' | 'maybe' | 'no' | — | — |