Skip to content

Commit 1355389

Browse files
committed
feat: rounded property to toggle
1 parent 7b07886 commit 1355389

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

packages/component-library/src/SingleToggleGroup/index.module.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
transition-duration: 100ms;
2121
transition-timing-function: linear;
2222
}
23-
23+
&[data-rounded] {
24+
border-radius: theme.border-radius("full");
25+
.bubble {
26+
border-radius: theme.border-radius("full");
27+
}
28+
}
29+
2430
&[data-selected] {
2531
color: theme.color("button", "solid", "foreground");
2632
pointer-events: none;
@@ -38,6 +44,7 @@
3844
);
3945
}
4046

47+
4148
&[data-pressed] .bubble {
4249
background-color: theme.color(
4350
"button",

packages/component-library/src/SingleToggleGroup/index.stories.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { SingleToggleGroup as SingleToggleGroupComponent } from "./index.jsx";
55
const meta = {
66
component: SingleToggleGroupComponent,
77
argTypes: {
8+
rounded: {
9+
control: "boolean",
10+
table: {
11+
category: "Appearance",
12+
},
13+
},
814
items: {
915
table: {
1016
disable: true,
@@ -21,6 +27,7 @@ export default meta;
2127

2228
export const SingleToggleGroup = {
2329
args: {
30+
rounded: false,
2431
items: [
2532
{ id: "foo", children: "Foo" },
2633
{ id: "bar", children: "Bar" },

packages/component-library/src/SingleToggleGroup/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ type OwnProps = {
1414
selectedKey?: Key | undefined;
1515
onSelectionChange?: (newValue: Key) => void;
1616
items: ComponentProps<typeof ToggleButton>[];
17+
rounded?: boolean | undefined;
1718
};
19+
1820
type Props = Omit<
1921
ComponentProps<typeof ToggleButtonGroup>,
2022
keyof OwnProps | "selectionMode" | "selectedKeys"
@@ -26,6 +28,7 @@ export const SingleToggleGroup = ({
2628
onSelectionChange,
2729
className,
2830
items,
31+
rounded = false,
2932
...props
3033
}: Props) => {
3134
const id = useId();
@@ -63,6 +66,7 @@ export const SingleToggleGroup = ({
6366
)}
6467
data-size="sm"
6568
data-variant="ghost"
69+
data-rounded={rounded ? true : undefined}
6670
{...toggleButton}
6771
>
6872
{(args) => (

0 commit comments

Comments
 (0)