Skip to content

Commit

Permalink
Add styling
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Aug 13, 2024
1 parent cfe6546 commit 513c487
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion docs/data/base/components/radio-group/radio-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The `defaultValue` prop determines the initial value of the component when uncon

## Controlled

The `value` and `onValueChange` props contain the `value` string of the currently selected radio item in the radio group:
The `value` and `onValueChange` props contain the `value` string of the currently selected Radio item in the Radio Group:

```jsx
const [value, setValue] = React.useState('a');
Expand All @@ -101,3 +101,35 @@ return (
</RadioGroup.Root>
);
```

## Styling

The `Radio` components have a `[data-radio]` attribute with values `"checked"` or `"unchecked"` to style based on the checked state:

```jsx
<Radio.Root className="Radio">
<Radio.Indicator className="RadioIndicator" />
</Radio.Root>
```

```css
.Radio {
border: 1px solid black;
}

.RadioIndicator {
width: 20px;
height: 20px;
border-radius: 50%;
border: 1px solid black;
}

.Radio[data-radio='checked'] {
background: black;
color: white;
}

.RadioIndicator[data-radio='checked'] {
background: white;
}
```

0 comments on commit 513c487

Please sign in to comment.