Button
A conventional button with the usual variants.
Read the example →- Signature
ButtonProps extends ComponentPropsWithoutRef<"button">- Props
- variant, size, asChild, native button props
- Example
<Button>Click</Button>
Carefully composed shadcn/ui components for interfaces that need a little more personality than strictly necessary.
pnpm add gra-ui01 / Components
The complete public surface of gra-ui, including the newest way to make an element explain its own children.
A conventional button with the usual variants.
Read the example →ButtonProps extends ComponentPropsWithoutRef<"button"><Button>Click</Button>A button that cycles through labels before accepting a decision.
Read the example →IndecisiveButtonProps<IndecisiveButton>Decide</IndecisiveButton>A clone that reports how many children its element already has.
Read the example →CountedCloneProps<CountedClone element={<span>One child</span>} />02 / Component
A button that considers every option before committing to the one under your cursor.
Hover, focus, then click. No pressure.
03 / Component
It counts an element's children and stores the answer on the element, where it will help nobody.
data-child-count="1"04 / Usage
Import the compiled stylesheet once. Your application does not need Tailwind or additional source scanning.
import { IndecisiveButton } from "gra-ui";
import "gra-ui/styles.css";
<IndecisiveButton
choices={["Ship it", "Wait", "Ship it anyway"]}
interval={900}
onDecision={(choice) => console.log(choice)}
>
Decide
</IndecisiveButton>05 / API
Native button props, refs, sizes and variants are forwarded. The component adds only what its indecision requires.
childrenReactNodeThe stable label shown while the button is idle.choicesreadonly string[]Labels cycled while the button is active.intervalnumberDelay between choices. Defaults to 900 ms.onDecision(choice, index, event) => voidCalled with the visible choice on click.variantButton variantAny shadcn Button visual variant.