'use client'
import { HStack } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
export const RadioCardBasic = () => {
  return (
    <RadioCard.Root defaultValue="next">
      <RadioCard.Label>Select framework</RadioCard.Label>
      <HStack align="stretch">
        {items.map((item) => (
          <RadioCard.Item
            label={item.title}
            description={item.description}
            key={item.value}
            value={item.value}
          />
        ))}
      </HStack>
    </RadioCard.Root>
  )
}
const items = [
  { value: 'next', title: 'Next.js', description: 'Best for apps' },
  { value: 'vite', title: 'Vite', description: 'Best for SPAs' },
  { value: 'astro', title: 'Astro', description: 'Best for static sites' },
]
A RadioCard is a form element with a larger interaction surface represented as a card.
import { RadioCard } from '@saas-ui/react/radio-card'<RadioCard.Root>
  <RadioCard.Label />
  <RadioCard.Item />
</RadioCard.Root>Use the size prop to change the size of the radio card.
'use client'
import { For, HStack, Stack } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
export const RadioCardWithSizes = () => {
  return (
    <Stack gap="8">
      <For each={['sm', 'md', 'lg']}>
        {(size) => (
          <RadioCard.Root key={size} size={size} defaultValue="next">
            <RadioCard.Label>size = ({size})</RadioCard.Label>
            <HStack align="stretch">
              {items.map((item) => (
                <RadioCard.Item
                  label={item.title}
                  key={item.value}
                  value={item.value}
                />
              ))}
            </HStack>
          </RadioCard.Root>
        )}
      </For>
    </Stack>
  )
}
const items = [
  { value: 'next', title: 'Next.js' },
  { value: 'vite', title: 'Vite' },
]
Use the colorPalette prop to change the color of the radio card.
'use client'
import { For, HStack, Stack } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
import { colorPalettes } from '../lib/color-palettes'
export const RadioCardWithColors = () => {
  return (
    <Stack gap="8">
      <For each={colorPalettes}>
        {(colorPalette) => (
          <RadioCard.Root
            key={colorPalette}
            colorPalette={colorPalette}
            defaultValue="next"
          >
            <RadioCard.Label>Select Framework</RadioCard.Label>
            <HStack align="stretch">
              {items.map((item) => (
                <RadioCard.Item
                  label={item.title}
                  key={item.value}
                  value={item.value}
                />
              ))}
            </HStack>
          </RadioCard.Root>
        )}
      </For>
    </Stack>
  )
}
const items = [
  { value: 'next', title: 'Next.js' },
  { value: 'vite', title: 'Vite' },
]
Here's an example of a RadioCard with an icon.
'use client'
import { HStack, Icon } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
import { LuArrowRight, LuCircleOff, LuLock } from 'react-icons/lu'
export const RadioCardWithIcon = () => {
  return (
    <RadioCard.Root defaultValue="next">
      <RadioCard.Label>Select permission</RadioCard.Label>
      <HStack align="stretch">
        {items.map((item) => (
          <RadioCard.Item
            icon={
              <Icon fontSize="2xl" color="fg.muted" mb="2">
                {item.icon}
              </Icon>
            }
            label={item.title}
            description={item.description}
            key={item.value}
            value={item.value}
          />
        ))}
      </HStack>
    </RadioCard.Root>
  )
}
const items = [
  {
    icon: <LuArrowRight />,
    value: 'allow',
    title: 'Allow',
    description: 'This user can access the system',
  },
  {
    icon: <LuCircleOff />,
    value: 'deny',
    title: 'Deny',
    description: 'This user will be denied access to the system',
  },
  {
    icon: <LuLock />,
    value: 'lock',
    title: 'Lock',
    description: 'This user will be locked out of the system',
  },
]
Here's an example of a RadioCard with centered text.
'use client'
import { HStack, Icon } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
import { LuClock, LuDollarSign, LuTrendingUp } from 'react-icons/lu'
export const RadioCardCentered = () => {
  return (
    <RadioCard.Root orientation="vertical" align="center" defaultValue="next">
      <RadioCard.Label>Select contract type</RadioCard.Label>
      <HStack align="stretch">
        {items.map((item) => (
          <RadioCard.Item
            icon={
              <Icon fontSize="2xl" color="fg.muted" mb="2">
                {item.icon}
              </Icon>
            }
            label={item.title}
            key={item.value}
            value={item.value}
          />
        ))}
      </HStack>
    </RadioCard.Root>
  )
}
const items = [
  { icon: <LuDollarSign />, value: 'fixed', title: 'Fixed Rate' },
  { icon: <LuTrendingUp />, value: 'milestone', title: 'Milestone' },
  { icon: <LuClock />, value: 'hourly', title: 'Hourly' },
]
Use the RadioCardItemAddon component to add an addon below the radio card
content.
'use client'
import { HStack, RadioCardRoot } from '@chakra-ui/react'
import { RadioCard } from '@saas-ui/react'
export const RadioCardWithAddon = () => {
  return (
    <RadioCard.Root defaultValue="next">
      <RadioCard.Label>Select framework</RadioCard.Label>
      <HStack align="stretch">
        {items.map((item) => (
          <RadioCard.Item
            label={item.title}
            description={item.description}
            key={item.value}
            value={item.value}
            addon="Some addon text"
          />
        ))}
      </HStack>
    </RadioCard.Root>
  )
}
const items = [
  { value: 'next', title: 'Next.js', description: 'Best for apps' },
  { value: 'vite', title: 'Vite', description: 'Best for SPAs' },
  { value: 'astro', title: 'Astro', description: 'Best for static sites' },
]
| Prop | Default | Type | 
|---|---|---|
| colorPalette  | 'gray' | 'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink' | 'accent'The color palette of the component | 
| size  | 'md' | 'sm' | 'md' | 'lg'The size of the component | 
| variant  | 'outline' | 'plain' | 'subtle' | 'outline'The variant of the component | 
| as  | React.ElementTypeThe underlying element to render. | |
| asChild  | booleanUse the provided child element as the default rendered element, combining their props and behavior.For more details, read our Composition guide. | |
| unstyled  | booleanWhether to remove the component's style. |