KQ-921 · POLL/BUILDER
Poll Builder
A poll written in the composer and watched from the thread. Each option added slides in from 8px on glide while the composer's box takes its new height from a ResizeObserver on its own content on the same spring, and the multiple-answers switch morphs the preview's marks between circles and squares on snap. Posting is the rise: the draft's dashed edge goes solid and the bubble comes up on recoil while the box closes to a posted line. Enter inside an option adds a row and takes focus into it, Backspace in an empty one removes it, and Control or Command with Enter posts.
- Poll from You, still a draft.
Which slot should Friday's collection take?
- 07:00, before the yard fills
- 12:30, after the morning run
2 options · single answer
New poll
2/62 options · multiple off · ready to post
Install
One command — the source lands in your repo. Or copy it from the Code tab.
$ pnpm dlx shadcn@latest add @kinetiq/poll-builder
Props
- value / defaultValue
- PollDraft
- default —
- Controlled or initial draft: question, options and whether multiple answers are allowed.
- onValueChange
- (draft: PollDraft) => void
- default —
- Fires from every keystroke, add, remove and switch, from the setter that made the change.
- posted / defaultPosted
- boolean
- default false
- Controlled or initial posted state; the composer closes while it is true.
- onPostedChange
- (posted: boolean) => void
- default —
- Fires from Post and from the New poll control.
- onSend
- (draft: PollDraft) => void
- default —
- Fires with the trimmed draft the moment Post is pressed.
- maxOptions
- number
- default 6
- Options the poll may carry before Add option locks.
- minOptions
- number
- default 2
- Rows the builder will not go below, and the count Post requires.
- sender
- string
- default "You"
- Name used in the preview bubble's sentence.
- time
- string
- default —
- Already formatted; printed under the posted bubble. The component never reads a clock.
- label
- string
- default "Thread"
- Names the thread for assistive technology.
- disabled
- boolean
- default false
- Holds every field and control; the preview still reads.
| Prop | Type | Default | Description |
|---|---|---|---|
| value / defaultValue | PollDraft | — | Controlled or initial draft: question, options and whether multiple answers are allowed. |
| onValueChange | (draft: PollDraft) => void | — | Fires from every keystroke, add, remove and switch, from the setter that made the change. |
| posted / defaultPosted | boolean | false | Controlled or initial posted state; the composer closes while it is true. |
| onPostedChange | (posted: boolean) => void | — | Fires from Post and from the New poll control. |
| onSend | (draft: PollDraft) => void | — | Fires with the trimmed draft the moment Post is pressed. |
| maxOptions | number | 6 | Options the poll may carry before Add option locks. |
| minOptions | number | 2 | Rows the builder will not go below, and the count Post requires. |
| sender | string | "You" | Name used in the preview bubble's sentence. |
| time | string | — | Already formatted; printed under the posted bubble. The component never reads a clock. |
| label | string | "Thread" | Names the thread for assistive technology. |
| disabled | boolean | false | Holds every field and control; the preview still reads. |