File tree Expand file tree Collapse file tree 5 files changed +27
-7
lines changed
apps/website/src/routes/docs/headless/checkbox
packages/kit-headless/src/components/checkbox Expand file tree Collapse file tree 5 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export default component$(() => {
7
7
< CheckboxIndicator class = "flex h-[25px] w-[25px] items-center justify-center bg-slate-600" >
8
8
✅
9
9
</ CheckboxIndicator >
10
- No other stuff is needed here
10
+ Accept item
11
11
</ MyCheckbox >
12
12
</ >
13
13
) ;
Original file line number Diff line number Diff line change
1
+ import { component$ , useSignal , useStyles$ } from '@builder.io/qwik' ;
2
+ import { MyCheckbox , CheckboxIndicator , CheckList } from '@qwik-ui/headless' ;
3
+ export default component$ ( ( ) => {
4
+ return (
5
+ < >
6
+ < h3 id = "pizza-toppings" > Pizza toppings</ h3 >
7
+ < CheckList ariaLabeledBy = "pizza-toppings" >
8
+ < MyCheckbox
9
+ class = "flex items-center gap-3 border-2 border-black p-2 "
10
+ checkList = { true }
11
+ >
12
+ < CheckboxIndicator class = "flex h-[25px] w-[25px] items-center justify-center bg-slate-600" >
13
+ ✅
14
+ </ CheckboxIndicator >
15
+ Pick all toppings
16
+ </ MyCheckbox >
17
+ </ CheckList >
18
+ </ >
19
+ ) ;
20
+ } ) ;
Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ import { statusByComponent } from '~/_state/component-statuses';
12
12
Gives users a visual representation of what options they have picked and those that they have not by "checking" each option they want.
13
13
14
14
<Showcase name = " hero" />
15
+ <Showcase name = " pizza" />
Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ export const TriStateCheckbox = component$<TriStateCheckboxProps>((props) => {
150
150
const checklistContext = useContext ( CheckListContext ) ;
151
151
const childCheckboxes = checklistContext . checkboxes ;
152
152
const appliedSig = props . checkBoxSig ?? checklistContext . checklistSig ;
153
- const ariaControlsStrg = checklistContext . idArr . reduce ( ( p , c ) => p + ' ' + c ) ;
153
+ const ariaControlsStrg =
154
+ checklistContext . idArr . length === 0
155
+ ? ''
156
+ : checklistContext . idArr . reduce ( ( p , c ) => p + ' ' + c ) ;
154
157
useContextProvider ( CheckboxContext , appliedSig ) ;
155
158
useTask$ ( ( ) => { } ) ;
156
159
Original file line number Diff line number Diff line change @@ -84,11 +84,6 @@ export const CheckList: Component<CheckListProps> = (props: CheckListProps) => {
84
84
checklistChilds . forEach ( ( checkbox ) => {
85
85
Object . assign ( checkbox . props , { _overWriteCheckbox : true } ) ;
86
86
} ) ;
87
- // TODO: add code for controlled stuff
88
- // for (let index = 0; index < hellSigs.length; index++) {
89
- // const element = array[index];
90
- //
91
- // }
92
87
}
93
88
console . log ( 'fav idArr: ' , idArr ) ;
94
89
@@ -110,3 +105,4 @@ export const CheckList: Component<CheckListProps> = (props: CheckListProps) => {
110
105
</ >
111
106
) ;
112
107
} ;
108
+ // TODO: deprecate ariaLabelledBy
You can’t perform that action at this time.
0 commit comments