import { Label, XStack, YStack, styled } from 'tamagui'
import { createRadioGroup } from '@tamagui/radio-group'
const RADIO_GROUP_ITEM_NAME = 'RadioGroupItem'
const RadioGroupItemFrame = styled(YStack, {
name: RADIO_GROUP_ITEM_NAME,
render: 'button',
rounded: 1000,
bg: '$background',
items: 'center',
justify: 'center',
borderWidth: 1,
borderColor: '$borderColor',
p: 0,
hoverStyle: {
borderColor: '$borderColorHover',
bg: '$backgroundHover',
},
focusStyle: {
borderColor: '$borderColorHover',
bg: '$backgroundHover',
},
focusVisibleStyle: {
outlineStyle: 'solid',
outlineWidth: 2,
outlineColor: '$outlineColor',
},
pressStyle: {
borderColor: '$borderColorFocus',
bg: '$backgroundFocus',
},
variants: {
disabled: {
true: {
pointerEvents: 'none',
userSelect: 'none',
cursor: 'not-allowed',
hoverStyle: {
borderColor: '$borderColor',
bg: '$background',
},
pressStyle: {
borderColor: '$borderColor',
bg: '$background',
},
focusVisibleStyle: {
outlineWidth: 0,
},
},
},
},
} as const)
const RADIO_GROUP_INDICATOR_NAME = 'RadioGroupIndicator'
const RadioGroupIndicatorFrame = styled(YStack, {
name: RADIO_GROUP_INDICATOR_NAME,
width: '53%',
height: '53%',
rounded: 1000,
bg: '$color',
})
const RADIO_GROUP_NAME = 'RadioGroup'
const RadioGroupFrame = styled(YStack, {
name: RADIO_GROUP_NAME,
variants: {
orientation: {
horizontal: {
flexDirection: 'row',
spaceDirection: 'horizontal',
},
vertical: {
flexDirection: 'column',
spaceDirection: 'vertical',
},
},
} as const,
})
const RadioGroup = createRadioGroup({
Frame: RadioGroupFrame,
Indicator: RadioGroupIndicatorFrame,
Item: RadioGroupItemFrame,
})
export function RadioGroupUnstyledDemo() {
return (
)
}
function RadioGroupItemWithLabel(props: { value: string; label: string }) {
const id = `radiogroup-${props.value}`
return (
)
}