Skip to Content

SingleSelect

Radio-button style selection list. Stores the selected value under answers.<responseKey> and optionally auto-advances to the next page.

Props

PropTypeDefaultDescription
responseKeystringThe response key used to store the selected value (saved as answers.*)
optionsT[]Array of option objects
keyExtractor(item: T, index: number) => stringExtract a unique string value from each option. Falls back to item.value or the index.
renderItem(info: { item: T; index: number; active: boolean }) => ReactNodeRender each option. active is true when selected.
autoAdvancebooleantrueAutomatically navigate to the next page on selection
autoAdvanceDelaynumber200Delay in ms before auto-advancing
clickAnimation'none' | 'shrink' | 'grow''none'Tap/click animation style applied to each option
classNamestringContainer className

Example

import { SingleSelect } from '@appfunnel-dev/sdk/elements' const goals = [ { id: 'profit', label: 'Make a profit' }, { id: 'hobby', label: 'Just a hobby' }, ] export default function GoalPage() { return ( <SingleSelect options={goals} responseKey="goal" keyExtractor={(item) => item.id} renderItem={({ item, active }) => ( <div className={active ? 'border-blue-500 border-2' : 'border-gray-200 border'}> {item.label} </div> )} /> ) }
Last updated on