docs(www): add indeterminate state checkboxes on all data table demos and code examples (#1959)

Co-authored-by: shadcn <m@shadcn.com>
This commit is contained in:
Danilo Britto
2023-11-19 02:15:44 -05:00
committed by GitHub
parent c579e9232c
commit 9f3ae7746f
6 changed files with 24 additions and 6 deletions

View File

@@ -15,7 +15,10 @@ export const columns: ColumnDef<Task>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
className="translate-y-[2px]"

View File

@@ -746,7 +746,10 @@ export const columns: ColumnDef<Payment>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>

View File

@@ -92,7 +92,10 @@ export const columns: ColumnDef<Payment>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>

View File

@@ -81,7 +81,10 @@ export const columns: ColumnDef<Payment>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>

View File

@@ -92,7 +92,10 @@ export const columns: ColumnDef<Payment>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>

View File

@@ -85,7 +85,10 @@ export const columns: ColumnDef<Payment>[] = [
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
checked={
table.getIsAllPageRowsSelected() ||
(table.getIsSomePageRowsSelected() && "indeterminate")
}
onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
aria-label="Select all"
/>