Documentation
Form Components
Radio Cards

Radio Cards

The RadioCards component combines the functionality of radio buttons with the visual appeal of cards, allowing users to select a single option from a set of choices presented as cards. Each card acts as a radio button.

Installation

Install the package

npm i @start-base/react-form-elements

Add the styles

To use the React form elements styles in a Next.js project, import the styles in your layout.tsx file.

app/layout.tsx
import "@start-base/react-form-elements/styles.css";

Import the component

import RadioGroup from '@start-base/react-form-elements/RadioGroup';

Usages

Radio Cards Component Checked

Radio Cards Component Row

Radio Cards Component With Input

Radio Cards Component Disabled

Radio Cards Component Error

API

A card-style radio group component for enhanced visual presentation.

NameTypeDefaultDescription
namestringName of the input
labelstringnullLabel of the input
valuestring or numberValue of the input
onChangefunctionCallback function that is fired when the value changes.
inputClassNamestringnullClassname for input element
labelClassNamestringnullClassname for label element
errorClassNamestringnullClassname for error element
disabledbooleanfalseDisable the input
errorstring or boolean or objectnullError message to display below the input. if value is a boolean input border will be change. Also you can pass schema validator error objects.
optionsarray[]Array of options to display
optionLabelClassNamestringnullClassname for option label
cardClassNamestringnullClassname for option card
directionstringcolumnOptions direction column or row
hideInputbooleantrueInput hide option

Styling