Uncontrolled selection
Starts with Hero selected. Selecting Sidekick unchecks Hero.
defaultValue="hero" options={options}
WelkUI!REACT EDITIONExplore live variants, compare states, and learn every prop. Pick a component to start.
A native fieldset and legend containing labeled radio options. It manages one selected string value and can disable the entire group or individual options. Use value/onValueChange for controlled selection or defaultValue for local form state.
import { WelkRadioGroup } from "@welkui/react";
<WelkRadioGroup label="Choose your role" name="role"
defaultValue="hero" options={[
{ label: "Hero", value: "hero" },
{ label: "Sidekick", value: "sidekick" },
]} />Import @welkui/react/styles.css once in your app. Stateful snippets belong inside a React component.
These are real components, not screenshots. Compare their appearance and try the controls. Key props below each preview show what changes; use the usage example above for imports and component setup.
Starts with Hero selected. Selecting Sidekick unchecks Hero.
defaultValue="hero" options={options}The callback updates both the selected option and visible output.
value={role} onValueChange={setRole}The native fieldset disables every option at once.
disabledRequired props are marked in the default column. Other props are optional. ReactNode accepts text or JSX.
| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | Required | Visible, accessible control label. |
options | readonly WelkRadioOption[] | Required | Options: { label: ReactNode, value: string, disabled?: boolean }. |
value | string | Uncontrolled | Controlled selected option value. |
defaultValue | string | Unset | Initially selected option value. |
onValueChange | (value: string) => void | Unset | Called when an option is selected. |
required | boolean | false | Requires a selection in the native form. |
name | string | Generated | Shared native form field name for all options. |
Inherits native fieldset props except children, onChange and defaultValue, including disabled, form, className, style and aria-*; forwards a fieldset ref.
Import @welkui/react/styles.css once in your app entry or Next.js root layout. The previews use the default theme; override --welk-* CSS tokens in your app to customize it.
For Next.js, put hooks and event handlers in a component beginning with "use client". Keep state local to the component using the control. The library preserves its client boundaries and uses your installed React version.
Use defaultValue or defaultChecked for uncontrolled fields, or a state value and its change callback for controlled fields. Do not switch between these modes during the lifetime of a field.
Modal and notification examples start closed: use their Try buttons to see them. Disabled examples are deliberately non-interactive. Validate forms, uploads, authentication, and server responses in your application; these components only provide UI.