Modus UI

Bloom Choice

Web (React)

A row of mono chips where the chosen one swells with a springy pop.

Bloom Choice is a single-choice radio group of mono uppercase chips. Picking one makes it swell softly into the primary colour while its neighbours yield. Arrow keys, Home and End all work.

Modus / Bloom Choice

Installation

CLI

npx @modus-ui/cli add bloom-choice

Manual

  1. Copy the code from the component tab.
  2. Create a file at components/ui/bloom-choice.tsx.
  3. Paste the code.

Usage

tsx
import { BloomChoice } from "@/components/ui/bloom-choice";

export default function Example() {
  return <BloomChoice />;
}

Props

PropTypeDefaultDescription
itemsanyDEFAULT_ITEMSChoices, as strings or item objects.
valueany-Controlled selected value.
defaultValueany-Initial value when uncontrolled.
onChangeany-Called with the new value and index.
chipColorstring"hsl(var(--muted))"Chip background colour.
activeColorstring"hsl(var(--primary))"Selected chip colour.
textColorstring"hsl(var(--muted-foreground))"Chip text colour.
activeTextColorstring"hsl(var(--primary-foreground))"Selected chip text colour.
sizestring"md"Chip size: "sm", "md" or "lg".
gapnumber8Space between chips in pixels.
radiusnumber18Chip corner radius in pixels.
swellnumber0.2How much the chosen chip grows.
bargenumber6How far neighbours are pushed aside, in pixels.
shrinknumber0.05How much neighbours shrink.
jellynumber1Strength of the wobble.
bouncenumber0.25Spring bounce.
staggernumber22Delay between neighbour reactions in milliseconds.
stiffnessnumber580Spring stiffness.
disabledbooleanfalseDisables selection.
ariaLabelstring"Options"Accessible label for the group.

Comments

  • No comments yet.