Ask User Questions
fluid-functionalism/ask-user-questionsFreeComponent
Stepped question flow with numbered options, keyboard shortcuts (1–9), single or multi-select, inline 'other' text input, optional skip, proximity-based hover, and multi-question navigation. Auto-advances on selection in single-select.
Install it
npx shadcn@latest add https://fluidfunctionalism.com/r/ask-user-questions.jsonSource
1"use client";23import {4 forwardRef,5 useCallback,6 useEffect,7 useId,8 useMemo,9 useRef,10 useState,11 type HTMLAttributes,12 type KeyboardEvent as ReactKeyboardEvent,13} from "react";14import { AnimatePresence, motion } from "framer-motion";15import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";16import { Radio as RadioPrimitive } from "@base-ui/react/radio";17import { CheckboxGroup as CheckboxGroupPrimitive } from "@base-ui/react/checkbox-group";18import { Checkbox as CheckboxPrimitive } from "@base-ui/react/checkbox";19import { Field } from "@base-ui/react/field";20import { cn } from "@/lib/utils";21import { spring } from "@/lib/springs";22import { fontWeights } from "@/lib/font-weight";23import { useShape } from "@/lib/shape-context";24import { useIcon } from "@/lib/icon-context";25import { useProximityHover } from "@/hooks/use-proximity-hover";26import { useMergeSplitBlocks, SelectionBackgrounds } from "@/hooks/use-merge-split";27import { Button } from "@/components/ui/button";2829export interface AskUserOption {30 id?: string;31 title: string;32 description?: string;33}3435export interface AskUserQuestion {36 id?: string;37 title: string;38 /** Options to choose from. Optional only because a `freeText` question39 * has none; every other mode requires at least one. */40 options?: AskUserOption[];41 multiSelect?: boolean;42 allowOther?: boolean;43 otherPlaceholder?: string;44 skippable?: boolean;45 nextLabel?: string;46 /** Visual layout for each option row.47 * - "inline" (default): title and description on one line.48 * - "stacked": title above, description below — useful when descriptions49 * are long enough to wrap. */50 layout?: "inline" | "stacked";51 /** Which side of the row the numbered chip sits on.52 * - "right" (default): chip on the right; the single-select submit53 * arrow overlays it on hover/focus.54 * - "left": chip on the left, before the body. The submit arrow55 * still appears on the right edge of the row, so the action56 * affordance stays where the eye expects it.57 * Works with every other option (single/multi-select, allowOther,58 * inline/stacked layout). */59 chipPosition?: "left" | "right";60 /** Render a single multi-line textarea as the *only* answer, with no61 * option rows — for open-ended prompts (a name, a description, free62 * comments). Distinct from `allowOther`, which appends a free-text row63// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from fluid-functionalism
All 53 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | fluid-functionalism | Components | Free | 3 deps | |
| Accordion (Base UI)accordion-base | fluid-functionalism | Components | Free | 3 deps | |
| Badgebadge | fluid-functionalism | Components | Free | 1 dep | |
| Buttonbutton | fluid-functionalism | Components | Free | 4 deps | |
| Button (Base UI)button-base | fluid-functionalism | Components | Free | 4 deps | |
| Cardcard | fluid-functionalism | Components | Free | 1 dep | |
| Chat Messagechat-message | fluid-functionalism | Components | Free | 1 dep | |
| Checkbox Groupcheckbox-group | fluid-functionalism | Components | Free | 2 deps |
