1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
[data-component="radio-group"] {
--radio-group-height: 28px;
--radio-group-gap: 4px;
--radio-group-padding: 2px;
display: inline-flex;
[data-slot="radio-group-wrapper"] {
all: unset;
background-color: var(--surface-inset-base);
border-radius: var(--radius-sm);
box-shadow: var(--shadow-xxs-border);
display: inline-flex;
height: var(--radio-group-height);
margin: 0;
overflow: visible;
padding: 0;
position: relative;
width: fit-content;
}
&[data-fill] [data-slot="radio-group-wrapper"] {
width: 100%;
}
[data-slot="radio-group-items"] {
display: inline-flex;
flex-direction: row;
gap: var(--radio-group-gap);
height: 100%;
list-style: none;
position: relative;
z-index: 1;
}
&[data-fill] [data-slot="radio-group-items"] {
width: 100%;
}
[data-slot="radio-group-indicator"] {
background: var(--button-secondary-base);
border-radius: var(--radius-sm);
box-shadow: var(--shadow-xs-border-base);
content: "";
opacity: var(--indicator-opacity, 1);
pointer-events: none;
position: absolute;
transition:
opacity 200ms ease-out,
box-shadow 100ms ease-in-out,
width 200ms cubic-bezier(0.22, 1.2, 0.36, 1),
height 200ms cubic-bezier(0.22, 1.2, 0.36, 1),
transform 300ms cubic-bezier(0.22, 1.2, 0.36, 1);
will-change: transform;
z-index: 0;
}
[data-slot="radio-group-item"] {
display: flex;
height: 100%;
min-width: 0;
position: relative;
}
&[data-fill] [data-slot="radio-group-item"] {
flex: 1;
}
[data-slot="radio-group-item-input"] {
border-width: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
[data-slot="radio-group-item-label"] {
color: var(--text-weak);
cursor: default;
display: flex;
align-items: center;
justify-content: center;
font-family: var(--font-family-sans);
font-size: var(--font-size-small);
font-weight: var(--font-weight-medium);
flex: 1;
height: 100%;
line-height: 1;
padding: var(--radio-group-padding);
position: relative;
transition:
color 200ms ease-out,
opacity 200ms ease-out;
user-select: none;
}
[data-slot="radio-group-item-control"] {
align-items: center;
border-radius: var(--radius-xs);
display: inline-flex;
height: 100%;
justify-content: center;
min-width: 0;
padding: var(--radio-group-control-padding, 0 10px);
transition: background-color 200ms ease-out;
width: 100%;
}
&[data-pad="none"] {
--radio-group-control-padding: 0;
}
&[data-pad="normal"] {
--radio-group-control-padding: 0 10px;
}
/* Checked state */
[data-slot="radio-group-item-input"][data-checked] + [data-slot="radio-group-item-label"] {
color: var(--text-strong);
}
/* Hover state: match the inset background (adds subtle density) */
[data-slot="radio-group-item-input"]:not([data-checked], [data-disabled])
+ [data-slot="radio-group-item-label"]:hover
[data-slot="radio-group-item-control"] {
background-color: var(--surface-inset-base);
}
/* Do not overlay hover on the active segment */
[data-slot="radio-group-item-input"][data-checked]
+ [data-slot="radio-group-item-label"]:hover
[data-slot="radio-group-item-control"] {
background-color: transparent;
}
/* Disabled state */
[data-slot="radio-group-item-input"][data-disabled] + [data-slot="radio-group-item-label"] {
cursor: not-allowed;
opacity: 0.5;
}
/* Focus state */
[data-slot="radio-group-wrapper"]:has([data-slot="radio-group-item-input"]:focus-visible)
[data-slot="radio-group-indicator"] {
box-shadow: var(--shadow-xs-border-focus);
}
/* Hide indicator when nothing is checked */
[data-slot="radio-group-wrapper"]:not(:has([data-slot="radio-group-item-input"][data-checked]))
[data-slot="radio-group-indicator"] {
--indicator-opacity: 0;
}
/* Vertical orientation */
&[aria-orientation="vertical"] [data-slot="radio-group-items"] {
flex-direction: column;
}
/* Small size variant */
&[data-size="small"] {
--radio-group-height: 24px;
--radio-group-gap: 3px;
--radio-group-padding: 2px;
[data-slot="radio-group-item-label"] {
font-size: 12px;
}
[data-slot="radio-group-item-control"] {
padding: var(--radio-group-control-padding, 0 8px);
}
}
&[data-size="small"][data-pad="normal"] {
--radio-group-control-padding: 0 8px;
}
/* Disabled root state */
&[data-disabled] {
opacity: 0.5;
cursor: not-allowed;
}
}
|