1
1
import type { PropsOf , QRL , Signal } from '@builder.io/qwik' ;
2
- import { component$ , useContextProvider , Slot , useTask$ , $ } from '@builder.io/qwik' ;
2
+ import {
3
+ component$ ,
4
+ useContextProvider ,
5
+ Slot ,
6
+ useTask$ ,
7
+ $ ,
8
+ useStyles$ ,
9
+ } from '@builder.io/qwik' ;
3
10
import {
4
11
toggleGroupRootApiContextId ,
5
12
type Direction ,
@@ -8,6 +15,7 @@ import {
8
15
} from './toggle-group-context' ;
9
16
import { useToggleGroup } from './use-toggle' ;
10
17
import { isBrowser , isServer } from '@builder.io/qwik/build' ;
18
+ import styles from './toggle-group.css?inline' ;
11
19
12
20
export type ToggleGroupBaseProps = {
13
21
/**
@@ -87,6 +95,7 @@ export type ToggleGroupApiProps = (ToggleGroupSingleProps | ToggleGroupMultipleP
87
95
export type ToggleGroupRootProps = PropsOf < 'div' > & ToggleGroupApiProps ;
88
96
89
97
export const HToggleGroupRoot = component$ < ToggleGroupRootProps > ( ( props ) => {
98
+ useStyles$ ( styles ) ;
90
99
const {
91
100
onChange$ : _ ,
92
101
disabled = false ,
@@ -97,7 +106,6 @@ export const HToggleGroupRoot = component$<ToggleGroupRootProps>((props) => {
97
106
} = props ;
98
107
99
108
const commonProps = { role : 'group' , 'aria-orientation' : orientation , dir : direction } ;
100
- const orientationClass = orientation === 'vertical' ? 'flex-col' : 'flex-row' ;
101
109
102
110
const api = useToggleGroup ( props ) ;
103
111
@@ -275,8 +283,8 @@ export const HToggleGroupRoot = component$<ToggleGroupRootProps>((props) => {
275
283
< div
276
284
{ ...divProps }
277
285
{ ...commonProps }
278
- class = { `flex ${ orientationClass } items-center gap-1` }
279
286
data-qui-togglegroup-root
287
+ data-orientation = { orientation }
280
288
>
281
289
< Slot />
282
290
</ div >
0 commit comments