Velocity X Components

Long-form

Inline Poll

A single-question poll dropped mid-article, with real radio-button options and a result bar that appears once the reader votes. Keyboard- and screen-reader-operable out of the box; your own API call owns persisting the vote and the caller supplies the tallies back in — this never fakes a backend.

Subscription Included with the Velocity Components subscription.
bash
$ velocityx add inline-poll

Built for astro.

Full docs for Inline Poll →

Needs a licence key — subscribe here, then velocityx loginonce.

astro v1.0.1
Inline Poll
Rewrite from scratch, or refactor in place?
Rewrite from scratch 27%
Refactor in place (your vote) 73%

Thanks for voting — 153 votes so far.

Props

NameTypeRequiredDefaultDescription
slugstringYesStable identifier for this poll — passed back in the `vote` event detail and used for the fieldset/radio names.
questionstringYes
optionsPollOption[]Yes
resultsRecord<string, number>NoVote counts per option id, if the caller already knows them (e.g. after a reload). Omit before any votes exist.
votedOptionIdstringNoOption id the current visitor already voted for, if any — renders the poll straight into its result state.

File this creates

The CLI writes this path into your project, relative to its root — nothing else moves.

text
components/velocity/inline-poll/InlinePoll.astro

Using the Inline Poll component

Install it with velocityx add inline-poll. The CLI writes the source straight into your project — no runtime dependency, no registry lock-in, and it themes itself from the same primary-*/accent-* scale as the rest of the library.

More from Long-form.