checkbox-01
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
export function CheckboxBasic() {
return (
<FieldGroup className="mx-auto w-56">
<Field orientation="horizontal">
<Checkbox id="terms-checkbox-basic" name="terms-checkbox-basic" />
<FieldLabel htmlFor="terms-checkbox-basic">
Accept terms and conditions
</FieldLabel>
</Field>
</FieldGroup>
)
}checkbox-02
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field"
export function CheckboxDescription() {
return (
<FieldGroup className="mx-auto w-72">
<Field orientation="horizontal">
<Checkbox
id="terms-checkbox-desc"
name="terms-checkbox-desc"
defaultChecked
/>
<FieldContent>
<FieldLabel htmlFor="terms-checkbox-desc">
Accept terms and conditions
</FieldLabel>
<FieldDescription>
By clicking this checkbox, you agree to the Designali terms and conditions.
</FieldDescription>
</FieldContent>
</Field>
</FieldGroup>
)
}checkbox-03
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
export function CheckboxDisabled() {
return (
<FieldGroup className="mx-auto w-56">
<Field orientation="horizontal" data-disabled>
<Checkbox
id="toggle-checkbox-disabled"
name="toggle-checkbox-disabled"
disabled
/>
<FieldLabel htmlFor="toggle-checkbox-disabled">
Enable notifications
</FieldLabel>
</Field>
</FieldGroup>
)
}checkbox-04
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldDescription,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
export function CheckboxGroup() {
return (
<FieldSet>
<FieldLegend variant="label">
Show these products on your Designali dashboard:
</FieldLegend>
<FieldDescription>
Select the Designali libraries you want to show on your dashboard.
</FieldDescription>
<FieldGroup className="gap-3">
<Field orientation="horizontal">
<Checkbox
id="finder-pref-9k2-hard-disks-ljj-checkbox"
name="finder-pref-9k2-hard-disks-ljj-checkbox"
defaultChecked
/>
<FieldLabel
htmlFor="finder-pref-9k2-hard-disks-ljj-checkbox"
className="font-normal"
>
Templates
</FieldLabel>
</Field>
<Field orientation="horizontal">
<Checkbox
id="finder-pref-9k2-external-disks-1yg-checkbox"
name="finder-pref-9k2-external-disks-1yg-checkbox"
defaultChecked
/>
<FieldLabel
htmlFor="finder-pref-9k2-external-disks-1yg-checkbox"
className="font-normal"
>
Blocks
</FieldLabel>
</Field>
<Field orientation="horizontal">
<Checkbox
id="finder-pref-9k2-cds-dvds-fzt-checkbox"
name="finder-pref-9k2-cds-dvds-fzt-checkbox"
/>
<FieldLabel
htmlFor="finder-pref-9k2-cds-dvds-fzt-checkbox"
className="font-normal"
>
Icons, logos, and illustrations
</FieldLabel>
</Field>
<Field orientation="horizontal">
<Checkbox
id="finder-pref-9k2-connected-servers-6l2-checkbox"
name="finder-pref-9k2-connected-servers-6l2-checkbox"
/>
<FieldLabel
htmlFor="finder-pref-9k2-connected-servers-6l2-checkbox"
className="font-normal"
>
UI examples
</FieldLabel>
</Field>
</FieldGroup>
</FieldSet>
)
}checkbox-05
Loading...
"use client"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
FieldTitle,
} from "@/components/ui/field"
import { Label } from "@/components/ui/label"
export function CheckboxDemo() {
return (
<FieldGroup className="max-w-sm">
<Field orientation="horizontal">
<Checkbox id="terms-checkbox" name="terms-checkbox" />
<Label htmlFor="terms-checkbox">Accept terms and conditions</Label>
</Field>
<Field orientation="horizontal">
<Checkbox
id="terms-checkbox-2"
name="terms-checkbox-2"
defaultChecked
/>
<FieldContent>
<FieldLabel htmlFor="terms-checkbox-2">
Accept terms and conditions
</FieldLabel>
<FieldDescription>
By clicking this checkbox, you agree to the Designali terms.
</FieldDescription>
</FieldContent>
</Field>
<Field orientation="horizontal" data-disabled>
<Checkbox id="toggle-checkbox" name="toggle-checkbox" disabled />
<FieldLabel htmlFor="toggle-checkbox">Enable notifications</FieldLabel>
</Field>
<FieldLabel>
<Field orientation="horizontal">
<Checkbox id="toggle-checkbox-2" name="toggle-checkbox-2" />
<FieldContent>
<FieldTitle>Enable notifications</FieldTitle>
<FieldDescription>
You can enable or disable notifications at any time.
</FieldDescription>
</FieldContent>
</Field>
</FieldLabel>
</FieldGroup>
)
}checkbox-06
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
const tableData = [
{
id: "1",
name: "Ali Imam",
email: "ali@designali.com",
role: "Admin",
},
{
id: "2",
name: "Sara (Designer)",
email: "sara@designali.com",
role: "User",
},
{
id: "3",
name: "Omar (Developer)",
email: "omar@designali.com",
role: "User",
},
{
id: "4",
name: "Lena (Client)",
email: "lena@example.com",
role: "Editor",
},
]
export function CheckboxInTable() {
const [selectedRows, setSelectedRows] = React.useState<Set<string>>(
new Set(["1"])
)
const selectAll = selectedRows.size === tableData.length
const handleSelectAll = (checked: boolean) => {
if (checked) {
setSelectedRows(new Set(tableData.map((row) => row.id)))
} else {
setSelectedRows(new Set())
}
}
const handleSelectRow = (id: string, checked: boolean) => {
const newSelected = new Set(selectedRows)
if (checked) {
newSelected.add(id)
} else {
newSelected.delete(id)
}
setSelectedRows(newSelected)
}
return (
<Table>
<TableHeader>
<TableRow>
<TableHead className="w-8">
<Checkbox
id="select-all-checkbox"
name="select-all-checkbox"
checked={selectAll}
onCheckedChange={handleSelectAll}
/>
</TableHead>
<TableHead>Name</TableHead>
<TableHead>Email</TableHead>
<TableHead>Role</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{tableData.map((row) => (
<TableRow
key={row.id}
data-state={selectedRows.has(row.id) ? "selected" : undefined}
>
<TableCell>
<Checkbox
id={`row-${row.id}-checkbox`}
name={`row-${row.id}-checkbox`}
checked={selectedRows.has(row.id)}
onCheckedChange={(checked) =>
handleSelectRow(row.id, checked === true)
}
/>
</TableCell>
<TableCell className="font-medium">{row.name}</TableCell>
<TableCell>{row.email}</TableCell>
<TableCell>{row.role}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
)
}checkbox-07
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldGroup,
FieldLabel,
FieldSet,
} from "@/components/ui/field"
const toppings = ["Logo", "Color palette", "Typography", "Brand guidelines"]
export function SelectAllIndeterminate() {
const [selected, setSelected] = React.useState<string[]>(["Color palette"])
const all = selected.length === toppings.length
const some = selected.length > 0 && !all
return (
<FieldSet className="w-full max-w-xs">
<Field orientation="horizontal">
<Checkbox
id="toppings-all"
checked={all}
indeterminate={some}
onCheckedChange={(checked) => setSelected(checked ? toppings : [])}
className="data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground"
/>
<FieldLabel htmlFor="toppings-all">All brand identity deliverables</FieldLabel>
</Field>
<FieldGroup className="gap-3 ps-6">
{toppings.map((topping) => (
<Field key={topping} orientation="horizontal">
<Checkbox
id={"topping-" + topping}
checked={selected.includes(topping)}
onCheckedChange={(checked) =>
setSelected((list) =>
checked
? [...list, topping]
: list.filter((t) => t !== topping)
)
}
/>
<FieldLabel htmlFor={"topping-" + topping} className="font-normal">
{topping}
</FieldLabel>
</Field>
))}
</FieldGroup>
</FieldSet>
)
}
checkbox-08
Loading...
import { Checkbox } from "@/components/ui/checkbox"
const channels = ["Email", "Push", "SMS"]
const events = [
{ id: "mentions", label: "Mentions", defaults: ["Email", "Push"] },
{ id: "comments", label: "Client comments", defaults: ["Push"] },
{ id: "invoices", label: "Designali invoices", defaults: ["Email"] },
{
id: "security",
label: "Security alerts",
defaults: ["Email", "Push", "SMS"],
},
]
export function NotificationChannelMatrix() {
return (
<div className="w-full max-w-md border">
<div className="grid grid-cols-[1fr_repeat(3,3.5rem)] border-b bg-muted/40 px-3 py-2 text-xs font-medium">
<span>Event</span>
{channels.map((channel) => (
<span key={channel} className="text-center">
{channel}
</span>
))}
</div>
{events.map((event) => (
<div
key={event.id}
className="grid grid-cols-[1fr_repeat(3,3.5rem)] items-center border-b px-3 py-2.5 last:border-b-0"
>
<span className="text-sm">{event.label}</span>
{channels.map((channel) => (
<div key={channel} className="flex justify-center">
<Checkbox
aria-label={event.label + " via " + channel}
name={event.id}
value={channel}
defaultChecked={event.defaults.includes(channel)}
disabled={event.id === "security" && channel === "Email"}
/>
</div>
))}
</div>
))}
</div>
)
}
checkbox-09
Loading...
"use client"
import * as React from "react"
import {
Plus as PlusIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Input } from "@/components/ui/input"
import { cn } from "@/lib/utils"
export function TodoListStrikethrough() {
const [todos, setTodos] = React.useState([
{ id: 1, text: "Reply to client design feedback", done: true },
{ id: 2, text: "Prepare Designali blocks demo", done: false },
{ id: 3, text: "Export new icons to @designali/icons", done: false },
])
const [draft, setDraft] = React.useState("")
const remaining = todos.filter((t) => !t.done).length
return (
<div className="flex w-full max-w-sm flex-col gap-3">
<form
className="flex gap-2"
onSubmit={(e) => {
e.preventDefault()
if (!draft.trim()) return
setTodos((list) => [
...list,
{ id: Date.now(), text: draft.trim(), done: false },
])
setDraft("")
}}
>
<Input
value={draft}
onChange={(e) => setDraft(e.target.value)}
placeholder="Add a task"
/>
<Button type="submit" size="icon" aria-label="Add task">
<PlusIcon />
</Button>
</form>
<ul className="flex flex-col divide-y border">
{todos.map((todo) => (
<li key={todo.id}>
<label className="flex cursor-pointer items-center gap-3 px-3 py-2.5">
<Checkbox
checked={todo.done}
onCheckedChange={(checked) =>
setTodos((list) =>
list.map((t) =>
t.id === todo.id ? { ...t, done: checked } : t
)
)
}
/>
<span
className={cn(
"text-sm",
todo.done && "text-muted-foreground line-through"
)}
>
{todo.text}
</span>
</label>
</li>
))}
</ul>
<p className="text-xs text-muted-foreground">{remaining} remaining</p>
</div>
)
}
checkbox-10
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldError,
FieldLabel,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"
export function TermsRequiredInvalid() {
const [accepted, setAccepted] = React.useState(false)
const [submitted, setSubmitted] = React.useState(false)
const invalid = submitted && !accepted
return (
<form
className="flex w-full max-w-xs flex-col gap-4"
onSubmit={(e) => {
e.preventDefault()
setSubmitted(true)
}}
>
<Field>
<FieldLabel htmlFor="signup-email">Work email</FieldLabel>
<Input id="signup-email" type="email" placeholder="you@example.com" />
</Field>
<Field orientation="horizontal" data-invalid={invalid || undefined}>
<Checkbox
id="signup-terms"
checked={accepted}
onCheckedChange={setAccepted}
aria-invalid={invalid || undefined}
/>
<FieldContent>
<FieldLabel htmlFor="signup-terms">
I agree to the Designali Terms of Service
</FieldLabel>
{invalid && (
<FieldError>You must accept the terms to continue.</FieldError>
)}
</FieldContent>
</Field>
<Button type="submit">Create Designali account</Button>
{submitted && accepted && (
<p className="text-xs text-muted-foreground">
Account created. Check your inbox.
</p>
)}
</form>
)
}
checkbox-11
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
FieldTitle,
} from "@/components/ui/field"
const addons = [
{
id: "backup",
title: "Icon pack",
description: "4000+ icons from @designali/icons",
price: 8,
},
{
id: "domain",
title: "Logo library",
description: "Brand logos from @designali/logos",
price: 4,
},
{
id: "support",
title: "Priority support",
description: "1-hour response from the Designali team",
price: 19,
},
]
export function AddonCardSelection() {
const [picked, setPicked] = React.useState<string[]>(["backup"])
const total = addons
.filter((a) => picked.includes(a.id))
.reduce((s, a) => s + a.price, 0)
return (
<FieldGroup className="w-full max-w-sm gap-3">
{addons.map((addon) => (
<FieldLabel key={addon.id} htmlFor={"addon-" + addon.id}>
<Field orientation="horizontal">
<Checkbox
id={"addon-" + addon.id}
checked={picked.includes(addon.id)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked
? [...list, addon.id]
: list.filter((id) => id !== addon.id)
)
}
/>
<FieldContent>
<FieldTitle>{addon.title}</FieldTitle>
<FieldDescription>{addon.description}</FieldDescription>
</FieldContent>
<span className="text-sm font-medium">+${addon.price}/mo</span>
</Field>
</FieldLabel>
))}
<div className="flex items-center justify-between border-t pt-3 text-sm">
<span className="text-muted-foreground">Add-ons total</span>
<span className="font-semibold">${total}/mo</span>
</div>
</FieldGroup>
)
}
checkbox-12
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
const groups = [
{ id: "projects", label: "Projects", perms: ["View", "Create", "Archive"] },
{
id: "billing",
label: "Billing",
perms: ["View invoices", "Update payment method"],
},
{
id: "members",
label: "Members",
perms: ["Invite", "Remove", "Change roles"],
},
]
export function RolePermissionGroups() {
const [granted, setGranted] = React.useState<Record<string, string[]>>({
projects: ["View", "Create"],
billing: [],
members: ["Invite"],
})
return (
<div className="flex w-full max-w-sm flex-col divide-y border">
{groups.map((group) => {
const list = granted[group.id] ?? []
const all = list.length === group.perms.length
return (
<div key={group.id} className="flex flex-col gap-2.5 p-3">
<label className="flex items-center gap-2 text-sm font-medium">
<Checkbox
checked={all}
indeterminate={list.length > 0 && !all}
onCheckedChange={(checked) =>
setGranted((g) => ({
...g,
[group.id]: checked ? group.perms : [],
}))
}
className="data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground"
/>
{group.label}
<span className="ms-auto text-xs font-normal text-muted-foreground">
{list.length}/{group.perms.length}
</span>
</label>
<div className="flex flex-col gap-2 ps-6">
{group.perms.map((perm) => (
<label key={perm} className="flex items-center gap-2 text-xs">
<Checkbox
checked={list.includes(perm)}
onCheckedChange={(checked) =>
setGranted((g) => ({
...g,
[group.id]: checked
? [...list, perm]
: list.filter((p) => p !== perm),
}))
}
/>
{perm}
</label>
))}
</div>
</div>
)
})}
</div>
)
}
checkbox-13
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
const filters: Record<string, [string, number][]> = {
Category: [
["Templates", 42],
["Blocks", 18],
["Landing pages", 27],
],
Stack: [
["Next.js", 30],
["React", 54],
["Tailwind CSS", 41],
["Vue", 0],
],
}
export function ProductFilterSidebar() {
const [active, setActive] = React.useState<string[]>(["React"])
const toggle = (value: string, checked: boolean) =>
setActive((list) =>
checked ? [...list, value] : list.filter((v) => v !== value)
)
return (
<div className="flex w-full max-w-[14rem] flex-col gap-4">
<div className="flex items-center justify-between">
<span className="text-sm font-medium">Filters</span>
<Button
variant="link"
size="xs"
disabled={active.length === 0}
onClick={() => setActive([])}
>
Clear ({active.length})
</Button>
</div>
{Object.entries(filters).map(([group, options]) => (
<FieldSet key={group}>
<FieldLegend variant="label">{group}</FieldLegend>
<FieldGroup className="gap-2.5">
{options.map(([value, count]) => (
<Field
key={value}
orientation="horizontal"
data-disabled={count === 0 || undefined}
>
<Checkbox
id={"filter-" + value}
checked={active.includes(value)}
disabled={count === 0}
onCheckedChange={(checked) => toggle(value, checked)}
/>
<FieldLabel
htmlFor={"filter-" + value}
className="flex-1 font-normal"
>
{value}
</FieldLabel>
<span className="text-xs text-muted-foreground">{count}</span>
</Field>
))}
</FieldGroup>
</FieldSet>
))}
</div>
)
}
checkbox-14
Loading...
"use client"
import * as React from "react"
import {
Archive as ArchiveIcon,
MailOpen as MailOpenIcon,
Trash2 as Trash2Icon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const messages = [
{ id: "1", from: "Ali Imam", subject: "Brand identity draft v2", time: "9:41" },
{ id: "2", from: "Billing", subject: "Your Designali November invoice", time: "8:12" },
{
id: "3",
from: "Sara (Designer)",
subject: "Figma review on Thursday?",
time: "Yesterday",
},
{ id: "4", from: "Status Bot", subject: "Weekly designali.com uptime report", time: "Mon" },
]
export function InboxBulkActions() {
const [selected, setSelected] = React.useState<string[]>([])
const all = selected.length === messages.length
return (
<div className="w-full max-w-md border">
<div className="flex h-11 items-center gap-3 border-b bg-muted/40 px-3">
<Checkbox
aria-label="Select all messages"
checked={all}
indeterminate={selected.length > 0 && !all}
onCheckedChange={(checked) =>
setSelected(checked ? messages.map((m) => m.id) : [])
}
className="data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground"
/>
{selected.length > 0 ? (
<>
<span className="text-xs font-medium">
{selected.length} selected
</span>
<div className="ms-auto flex gap-1">
<Button variant="ghost" size="icon-sm" aria-label="Archive">
<ArchiveIcon />
</Button>
<Button variant="ghost" size="icon-sm" aria-label="Mark as read">
<MailOpenIcon />
</Button>
<Button variant="ghost" size="icon-sm" aria-label="Delete">
<Trash2Icon />
</Button>
</div>
</>
) : (
<span className="text-xs text-muted-foreground">Inbox</span>
)}
</div>
{messages.map((message) => {
const checked = selected.includes(message.id)
return (
<label
key={message.id}
className={cn(
"flex cursor-pointer items-center gap-3 border-b px-3 py-2.5 last:border-b-0",
checked && "bg-muted/60"
)}
>
<Checkbox
checked={checked}
onCheckedChange={(value) =>
setSelected((list) =>
value
? [...list, message.id]
: list.filter((id) => id !== message.id)
)
}
/>
<div className="min-w-0 flex-1">
<p className="truncate text-sm font-medium">{message.from}</p>
<p className="truncate text-xs text-muted-foreground">
{message.subject}
</p>
</div>
<span className="text-[11px] text-muted-foreground">
{message.time}
</span>
</label>
)
})}
</div>
)
}
checkbox-15
Loading...
import {
ShieldCheck as ShieldCheckIcon,
} from "@designali/icons"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { cn } from "@/lib/utils"
const controls = [
{ label: "Data encrypted at rest", done: true },
{ label: "SSO enforced for all members", done: true },
{ label: "Quarterly access review", done: false },
{ label: "Vendor risk assessment", done: true },
]
export function ReadOnlyComplianceSummary() {
return (
<Card className="w-full max-w-xs">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<ShieldCheckIcon className="size-4" />
Compliance status
</CardTitle>
<CardDescription>Managed by the Designali workspace admin.</CardDescription>
</CardHeader>
<CardContent>
<FieldGroup className="gap-3">
{controls.map((control, index) => (
<Field key={control.label} orientation="horizontal">
<Checkbox
id={"control-" + index}
checked={control.done}
readOnly
/>
<FieldLabel
htmlFor={"control-" + index}
className={cn(
"font-normal",
!control.done && "text-muted-foreground"
)}
>
{control.label}
</FieldLabel>
</Field>
))}
</FieldGroup>
</CardContent>
</Card>
)
}
checkbox-16
Loading...
import {
Lock as LockIcon,
} from "@designali/icons"
import { Badge } from "@/components/ui/badge"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import {
Tooltip,
TooltipContent,
TooltipTrigger,
} from "@/components/ui/tooltip"
const options = [
{ id: "watermark", label: "Remove watermark", pro: true },
{ id: "hd", label: "Export in 4K", pro: true },
{ id: "captions", label: "Burn in captions", pro: false },
]
export function DisabledWithUpgradeTooltip() {
return (
<FieldGroup className="w-full max-w-xs gap-3">
{options.map((option) => (
<Field
key={option.id}
orientation="horizontal"
data-disabled={option.pro || undefined}
>
<Checkbox
id={"export-" + option.id}
disabled={option.pro}
defaultChecked={!option.pro}
/>
<FieldLabel htmlFor={"export-" + option.id} className="font-normal">
{option.label}
</FieldLabel>
{option.pro && (
<Tooltip>
<TooltipTrigger
render={
<Badge variant="outline" className="ms-auto cursor-help">
<LockIcon />
Pro
</Badge>
}
/>
<TooltipContent>Available on the Designali Pro plan</TooltipContent>
</Tooltip>
)}
</Field>
))}
</FieldGroup>
)
}
checkbox-17
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const sizes = [
{ label: "Small", className: "size-3.5 [&_svg]:size-3", text: "text-xs" },
{ label: "Default", className: "", text: "text-sm" },
{ label: "Large", className: "size-5 [&_svg]:size-4", text: "text-sm" },
{ label: "Touch", className: "size-6 [&_svg]:size-5", text: "text-base" },
]
export function CheckboxSizeScale() {
return (
<div className="flex flex-wrap items-center gap-6">
{sizes.map((size) => (
<label
key={size.label}
className={cn("flex items-center gap-2", size.text)}
>
<Checkbox defaultChecked className={size.className} />
{size.label}
</label>
))}
</div>
)
}
checkbox-18
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const labels = [
{
name: "Bug",
color: "data-checked:bg-chart-1 data-checked:border-chart-1 border-chart-1",
},
{
name: "Feature",
color: "data-checked:bg-chart-2 data-checked:border-chart-2 border-chart-2",
},
{
name: "Docs",
color: "data-checked:bg-chart-3 data-checked:border-chart-3 border-chart-3",
},
{
name: "Design",
color: "data-checked:bg-chart-4 data-checked:border-chart-4 border-chart-4",
},
{
name: "Infra",
color: "data-checked:bg-chart-5 data-checked:border-chart-5 border-chart-5",
},
]
export function LabelColorCheckboxes() {
return (
<div className="flex w-full max-w-[12rem] flex-col gap-1 border p-2">
<span className="px-2 py-1 text-xs text-muted-foreground">
Filter by label
</span>
{labels.map((label, index) => (
<label
key={label.name}
className="flex cursor-pointer items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted"
>
<Checkbox
defaultChecked={index < 2}
className={cn("data-checked:text-background", label.color)}
/>
{label.name}
</label>
))}
</div>
)
}
checkbox-19
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const topics = [
"Templates",
"Design systems",
"AI workflows",
"Brand identity",
"UI/UX",
"Motion",
"CGI & 3D",
"Next.js",
"Tailwind CSS",
]
export function InterestChipCheckboxes() {
const [picked, setPicked] = React.useState<string[]>(["AI workflows", "Design systems"])
return (
<div className="flex w-full max-w-sm flex-col gap-4">
<div>
<h3 className="text-sm font-semibold">What are you into?</h3>
<p className="text-xs text-muted-foreground">
Pick at least three to personalise your Designali feed.
</p>
</div>
<div className="flex flex-wrap gap-2">
{topics.map((topic) => {
const checked = picked.includes(topic)
return (
<label
key={topic}
className={cn(
"flex cursor-pointer items-center gap-2 border px-3 py-1.5 text-xs transition-colors",
checked ? "border-primary bg-primary/5" : "hover:bg-muted"
)}
>
<Checkbox
checked={checked}
onCheckedChange={(value) =>
setPicked((list) =>
value ? [...list, topic] : list.filter((t) => t !== topic)
)
}
/>
{topic}
</label>
)
})}
</div>
<Button disabled={picked.length < 3}>Continue ({picked.length}/3)</Button>
</div>
)
}
checkbox-20
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"
export function BillingSameAsShipping() {
const [same, setSame] = React.useState(true)
return (
<FieldSet className="w-full max-w-sm">
<FieldLegend>Billing address</FieldLegend>
<Field orientation="horizontal">
<Checkbox id="billing-same" checked={same} onCheckedChange={setSame} />
<FieldLabel htmlFor="billing-same" className="font-normal">
Same as shipping address
</FieldLabel>
</Field>
{same ? (
<p className="border bg-muted/40 p-3 text-xs text-muted-foreground">
Ali Imam · Designali · billing@designali.com
</p>
) : (
<FieldGroup className="gap-3">
<Field>
<FieldLabel htmlFor="billing-street">Street</FieldLabel>
<Input id="billing-street" placeholder="123 Main St" />
</Field>
<div className="grid grid-cols-2 gap-3">
<Field>
<FieldLabel htmlFor="billing-city">City</FieldLabel>
<Input id="billing-city" />
</Field>
<Field>
<FieldLabel htmlFor="billing-zip">ZIP</FieldLabel>
<Input id="billing-zip" />
</Field>
</div>
</FieldGroup>
)}
</FieldSet>
)
}
checkbox-21
Loading...
import {
Activity as ActivityIcon,
Globe as GlobeIcon,
Search as SearchIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
import {
Item,
ItemActions,
ItemContent,
ItemDescription,
ItemGroup,
ItemMedia,
ItemTitle,
} from "@/components/ui/item"
const settings = [
{
id: "profile",
icon: GlobeIcon,
title: "Public profile",
description: "Anyone on designali.com can see your name and bio.",
on: true,
},
{
id: "activity",
icon: ActivityIcon,
title: "Show activity status",
description: "Let teammates see when you are online.",
on: true,
},
{
id: "search",
icon: SearchIcon,
title: "Appear in search",
description: "Allow people to find you by email.",
on: false,
},
]
export function PrivacySettingsItems() {
return (
<ItemGroup className="w-full max-w-md gap-2">
{settings.map((setting) => (
<Item
key={setting.id}
variant="outline"
render={<label htmlFor={"privacy-" + setting.id} />}
>
<ItemMedia variant="icon">
<setting.icon />
</ItemMedia>
<ItemContent>
<ItemTitle>{setting.title}</ItemTitle>
<ItemDescription>{setting.description}</ItemDescription>
</ItemContent>
<ItemActions>
<Checkbox
id={"privacy-" + setting.id}
defaultChecked={setting.on}
/>
</ItemActions>
</Item>
))}
</ItemGroup>
)
}
checkbox-22
Loading...
"use client"
import * as React from "react"
import {
FileMusic as FileAudioIcon,
FileCode as FileCodeIcon,
FileImage as FileImageIcon,
FileText as FileTextIcon,
Folder as FolderIcon,
Sheet as SheetIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const files = [
{ name: "designali-invoice-0412.pdf", icon: FileTextIcon },
{ name: "designali-moodboard.fig", icon: FileImageIcon },
{ name: "client-projects.xlsx", icon: SheetIcon },
{ name: "brand-reel-voiceover.mp3", icon: FileAudioIcon },
{ name: "blocks-readme.md", icon: FileCodeIcon },
{ name: "Logos", icon: FolderIcon },
]
export function FileGridSelection() {
const [selected, setSelected] = React.useState<string[]>(["designali-moodboard.fig"])
return (
<div className="flex w-full max-w-sm flex-col gap-2">
<p className="text-xs text-muted-foreground">
{selected.length
? selected.length + " selected"
: "Hover a file to select it"}
</p>
<div className="grid grid-cols-3 gap-2">
{files.map((file) => {
const checked = selected.includes(file.name)
return (
<label
key={file.name}
className={cn(
"group/file relative flex cursor-pointer flex-col items-center gap-2 border p-3 transition-colors hover:bg-muted/50",
checked && "border-primary bg-primary/5"
)}
>
<Checkbox
aria-label={"Select " + file.name}
checked={checked}
onCheckedChange={(value) =>
setSelected((list) =>
value
? [...list, file.name]
: list.filter((n) => n !== file.name)
)
}
className={cn(
"absolute start-2 top-2 bg-background transition-opacity",
!checked &&
"opacity-0 group-hover/file:opacity-100 focus-visible:opacity-100"
)}
/>
<file.icon className="size-7 text-muted-foreground" />
<span className="w-full truncate text-center text-[11px]">
{file.name}
</span>
</label>
)
})}
</div>
</div>
)
}
checkbox-23
Loading...
"use client"
import * as React from "react"
import {
Cookie as CookieIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field"
const categories = [
{
id: "necessary",
title: "Strictly necessary",
description: "Required for sign-in and security.",
locked: true,
},
{
id: "analytics",
title: "Analytics",
description: "Helps us understand how designali.com is used.",
},
{
id: "marketing",
title: "Marketing",
description: "Used to show relevant offers elsewhere.",
},
]
export function CookieConsentCategories() {
const [optional, setOptional] = React.useState<string[]>([])
return (
<Card className="w-full max-w-sm">
<CardHeader>
<CardTitle className="flex items-center gap-2">
<CookieIcon className="size-4" />
Cookie preferences
</CardTitle>
</CardHeader>
<CardContent>
<FieldGroup className="gap-4">
{categories.map((category) => (
<Field
key={category.id}
orientation="horizontal"
data-disabled={category.locked || undefined}
>
<Checkbox
id={"cookie-" + category.id}
checked={category.locked || optional.includes(category.id)}
disabled={category.locked}
onCheckedChange={(checked) =>
setOptional((list) =>
checked
? [...list, category.id]
: list.filter((id) => id !== category.id)
)
}
/>
<FieldContent>
<FieldLabel htmlFor={"cookie-" + category.id}>
{category.title}
</FieldLabel>
<FieldDescription>{category.description}</FieldDescription>
</FieldContent>
</Field>
))}
</FieldGroup>
</CardContent>
<CardFooter className="gap-2 border-t">
<Button variant="outline" size="sm" className="flex-1">
Save selection
</Button>
<Button
size="sm"
className="flex-1"
onClick={() => setOptional(["analytics", "marketing"])}
>
Accept all
</Button>
</CardFooter>
</Card>
)
}
checkbox-24
Loading...
"use client"
import * as React from "react"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Progress } from "@/components/ui/progress"
const items = [
"Figma file",
"Next.js build",
"Preview images",
"Docs page",
"Changelog",
"Pricing update",
]
export function PackingChecklistProgress() {
const [packed, setPacked] = React.useState<string[]>([
"Figma file",
"Next.js build",
])
const percent = Math.round((packed.length / items.length) * 100)
return (
<Card className="w-full max-w-xs">
<CardHeader>
<CardTitle>Designali template · Launch</CardTitle>
<CardDescription>
{packed.length} of {items.length} done
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
<Progress value={percent} aria-label="Launch progress" />
<FieldGroup className="gap-2.5">
{items.map((item) => (
<Field key={item} orientation="horizontal">
<Checkbox
id={"pack-" + item}
checked={packed.includes(item)}
onCheckedChange={(checked) =>
setPacked((list) =>
checked ? [...list, item] : list.filter((i) => i !== item)
)
}
/>
<FieldLabel htmlFor={"pack-" + item} className="font-normal">
{item}
</FieldLabel>
</Field>
))}
</FieldGroup>
</CardContent>
</Card>
)
}
checkbox-25
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
const days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
const shifts = ["AM", "PM"]
export function ShiftAvailabilityGrid() {
const [slots, setSlots] = React.useState<string[]>([
"Mon-AM",
"Tue-AM",
"Wed-PM",
"Sat-AM",
])
return (
<div className="w-full max-w-sm">
<p className="mb-2 text-sm font-medium">Your availability</p>
<div className="grid grid-cols-[2.5rem_repeat(7,1fr)] gap-y-2 border p-3 text-center text-xs">
<span />
{days.map((day) => (
<span key={day} className="text-muted-foreground">
{day}
</span>
))}
{shifts.map((shift) => (
<React.Fragment key={shift}>
<span className="text-start font-medium">{shift}</span>
{days.map((day) => {
const key = day + "-" + shift
return (
<div key={key} className="flex justify-center">
<Checkbox
aria-label={day + " " + shift}
checked={slots.includes(key)}
onCheckedChange={(checked) =>
setSlots((list) =>
checked ? [...list, key] : list.filter((s) => s !== key)
)
}
/>
</div>
)
})}
</React.Fragment>
))}
</div>
<p className="mt-2 text-xs text-muted-foreground">
{slots.length} shifts selected this week
</p>
</div>
)
}
checkbox-26
Loading...
"use client"
import * as React from "react"
import {
Calendar as CalendarIcon,
Eye as EyeIcon,
EyeOff as EyeOffIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const calendars = [
{
name: "Designali studio",
tone: "border-chart-1 data-checked:border-chart-1 data-checked:bg-chart-1",
},
{
name: "Personal",
tone: "border-chart-2 data-checked:border-chart-2 data-checked:bg-chart-2",
},
{
name: "Client projects",
tone: "border-chart-3 data-checked:border-chart-3 data-checked:bg-chart-3",
},
{
name: "Holidays",
tone: "border-chart-4 data-checked:border-chart-4 data-checked:bg-chart-4",
},
]
export function CalendarVisibilityList() {
const [visible, setVisible] = React.useState<string[]>([
"Designali studio",
"Personal",
"Holidays",
])
return (
<div className="flex w-full max-w-[14rem] flex-col gap-1">
<span className="flex items-center gap-2 px-2 py-1 text-xs font-medium text-muted-foreground">
<CalendarIcon className="size-3.5" />
My calendars
</span>
{calendars.map((calendar) => (
<label
key={calendar.name}
className="group/cal flex cursor-pointer items-center gap-2 px-2 py-1.5 text-sm hover:bg-muted"
>
<Checkbox
checked={visible.includes(calendar.name)}
onCheckedChange={(checked) =>
setVisible((list) =>
checked
? [...list, calendar.name]
: list.filter((n) => n !== calendar.name)
)
}
className={cn("data-checked:text-background", calendar.tone)}
/>
<span className="flex-1">{calendar.name}</span>
{visible.includes(calendar.name) ? (
<EyeIcon className="size-3.5 text-muted-foreground opacity-0 group-hover/cal:opacity-100" />
) : (
<EyeOffIcon className="size-3.5 text-muted-foreground" />
)}
</label>
))}
</div>
)
}
checkbox-27
Loading...
"use client"
import * as React from "react"
import {
Trash2 as Trash2Icon,
TriangleAlert as TriangleAlertIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
const acknowledgements = [
"All Designali projects and files will be permanently deleted.",
"Active subscriptions will be cancelled without refund.",
"This action cannot be undone.",
]
export function DeleteAccountConfirm() {
const [acked, setAcked] = React.useState<number[]>([])
return (
<Card className="w-full max-w-sm ring-destructive/30">
<CardHeader>
<CardTitle className="flex items-center gap-2 text-destructive">
<TriangleAlertIcon className="size-4" />
Delete workspace
</CardTitle>
<CardDescription>
Confirm you understand what happens next.
</CardDescription>
</CardHeader>
<CardContent>
<FieldGroup className="gap-3">
{acknowledgements.map((text, index) => (
<Field key={text} orientation="horizontal">
<Checkbox
id={"ack-" + index}
checked={acked.includes(index)}
onCheckedChange={(checked) =>
setAcked((list) =>
checked ? [...list, index] : list.filter((i) => i !== index)
)
}
/>
<FieldLabel htmlFor={"ack-" + index} className="font-normal">
{text}
</FieldLabel>
</Field>
))}
</FieldGroup>
</CardContent>
<CardFooter className="border-t">
<Button
variant="destructive"
className="w-full"
disabled={acked.length < acknowledgements.length}
>
<Trash2Icon data-icon="inline-start" />
Delete workspace
</Button>
</CardFooter>
</Card>
)
}
checkbox-28
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldDescription,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
const topics = [
"Templates",
"Design",
"Icons",
"Development",
"Case studies",
"Motion",
]
const LIMIT = 3
export function MaxSelectionLimit() {
const [picked, setPicked] = React.useState<string[]>(["Design"])
const atLimit = picked.length >= LIMIT
return (
<FieldSet className="w-full max-w-xs">
<FieldLegend>Designali newsletter topics</FieldLegend>
<FieldDescription>
Choose up to {LIMIT}. {LIMIT - picked.length} left.
</FieldDescription>
<FieldGroup className="grid grid-cols-2 gap-3">
{topics.map((topic) => {
const checked = picked.includes(topic)
const disabled = atLimit && !checked
return (
<Field
key={topic}
orientation="horizontal"
data-disabled={disabled || undefined}
>
<Checkbox
id={"topic-" + topic}
checked={checked}
disabled={disabled}
onCheckedChange={(value) =>
setPicked((list) =>
value ? [...list, topic] : list.filter((t) => t !== topic)
)
}
/>
<FieldLabel htmlFor={"topic-" + topic} className="font-normal">
{topic}
</FieldLabel>
</Field>
)
})}
</FieldGroup>
</FieldSet>
)
}
checkbox-29
Loading...
"use client"
import * as React from "react"
import {
Columns3 as Columns3Icon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
const columns = ["Customer", "Plan", "MRR", "Status"] as const
const rows = [
{ Customer: "Maya (designali.com)", Plan: "Team", MRR: "$480", Status: "Active" },
{
Customer: "Omar (Studio client)",
Plan: "Business",
MRR: "$1,250",
Status: "Trial",
},
{ Customer: "Lena (Freelancer)", Plan: "Starter", MRR: "$0", Status: "Churned" },
]
export function ColumnVisibilityPopover() {
const [shown, setShown] = React.useState<string[]>([
"Customer",
"Plan",
"MRR",
])
return (
<div className="flex w-full max-w-md flex-col gap-2">
<Popover>
<PopoverTrigger
render={<Button variant="outline" size="sm" className="self-end" />}
>
<Columns3Icon data-icon="inline-start" />
Columns
</PopoverTrigger>
<PopoverContent align="end" className="w-44">
<div className="flex flex-col gap-2.5">
{columns.map((column) => (
<label key={column} className="flex items-center gap-2 text-xs">
<Checkbox
checked={shown.includes(column)}
disabled={column === "Customer"}
onCheckedChange={(checked) =>
setShown((list) =>
checked
? [...list, column]
: list.filter((c) => c !== column)
)
}
/>
{column}
</label>
))}
</div>
</PopoverContent>
</Popover>
<Table>
<TableHeader>
<TableRow>
{columns
.filter((c) => shown.includes(c))
.map((c) => (
<TableHead key={c}>{c}</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{rows.map((row) => (
<TableRow key={row.Customer}>
{columns
.filter((c) => shown.includes(c))
.map((c) => (
<TableCell key={c}>{row[c]}</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
checkbox-30
Loading...
"use client"
import * as React from "react"
import {
Image as ImageIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
const photos = Array.from(
{ length: 7 },
(_, i) => "designali-render-" + (2041 + i) + ".jpg"
)
export function ShiftClickRangeSelect() {
const [selected, setSelected] = React.useState<number[]>([])
const lastIndex = React.useRef<number | null>(null)
const handleClick = (index: number, shiftKey: boolean) => {
const anchor = lastIndex.current
setSelected((list) => {
if (shiftKey && anchor !== null) {
const [from, to] = anchor < index ? [anchor, index] : [index, anchor]
const range = Array.from({ length: to - from + 1 }, (_, i) => from + i)
return Array.from(new Set([...list, ...range]))
}
return list.includes(index)
? list.filter((i) => i !== index)
: [...list, index]
})
lastIndex.current = index
}
return (
<div className="flex w-full max-w-xs flex-col gap-2">
<p className="text-xs text-muted-foreground">
Hold Shift to select a range · {selected.length} selected
</p>
<div className="flex flex-col border">
{photos.map((photo, index) => (
<div
key={photo}
className="flex items-center gap-3 border-b px-3 py-2 last:border-b-0"
>
<Checkbox
aria-label={"Select " + photo}
checked={selected.includes(index)}
onClick={(e) => {
e.preventDefault()
handleClick(index, e.shiftKey)
}}
/>
<ImageIcon className="size-4 text-muted-foreground" />
<span className="font-sans text-xs">{photo}</span>
</div>
))}
</div>
</div>
)
}
checkbox-31
Loading...
import {
Lock as LockIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
const envs = ["Dev", "Staging", "Prod"]
const flags = [
{ key: "templates-checkout", on: ["Dev", "Staging"] },
{ key: "ai-workflows", on: ["Dev"] },
{ key: "dark-mode-v2", on: ["Dev", "Staging", "Prod"] },
{ key: "usage-billing", on: [] as string[], locked: true },
]
export function FeatureFlagEnvironments() {
return (
<Table className="w-full max-w-md">
<TableHeader>
<TableRow>
<TableHead>Flag</TableHead>
{envs.map((env) => (
<TableHead key={env} className="w-16 text-center">
{env}
</TableHead>
))}
</TableRow>
</TableHeader>
<TableBody>
{flags.map((flag) => (
<TableRow key={flag.key}>
<TableCell className="font-sans text-xs">
{flag.key}
{flag.locked && (
<LockIcon className="ms-1 inline size-3 text-muted-foreground" />
)}
</TableCell>
{envs.map((env) => (
<TableCell key={env}>
<div className="flex justify-center">
<Checkbox
aria-label={flag.key + " in " + env}
defaultChecked={flag.on.includes(env)}
disabled={flag.locked}
/>
</div>
</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
)
}
checkbox-32
Loading...
"use client"
import * as React from "react"
import {
Download as DownloadIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
const fields = [
"Name",
"Email",
"Company",
"Phone",
"Country",
"Signup date",
"Plan",
"Last active",
]
export function ExportFieldsPicker() {
const [picked, setPicked] = React.useState<string[]>([
"Name",
"Email",
"Plan",
])
return (
<div className="flex w-full max-w-sm flex-col gap-3 border p-4">
<div className="flex items-center justify-between">
<span className="text-sm font-medium">Fields to export</span>
<div className="flex gap-1">
<Button variant="ghost" size="xs" onClick={() => setPicked(fields)}>
All
</Button>
<Button variant="ghost" size="xs" onClick={() => setPicked([])}>
None
</Button>
</div>
</div>
<div className="grid grid-cols-2 gap-x-4 gap-y-2.5">
{fields.map((field) => (
<label key={field} className="flex items-center gap-2 text-xs">
<Checkbox
checked={picked.includes(field)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked ? [...list, field] : list.filter((f) => f !== field)
)
}
/>
{field}
</label>
))}
</div>
<Button size="sm" disabled={picked.length === 0}>
<DownloadIcon data-icon="inline-start" />
Export {picked.length} fields
</Button>
</div>
)
}
checkbox-33
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const invoices = [
{ id: "INV-1042", due: "Overdue 4 days", amount: 1200, overdue: true },
{ id: "INV-1047", due: "Due Nov 20", amount: 640 },
{ id: "INV-1051", due: "Due Dec 2", amount: 2150 },
]
export function InvoicePaySelection() {
const [picked, setPicked] = React.useState<string[]>(["INV-1042"])
const total = invoices
.filter((i) => picked.includes(i.id))
.reduce((s, i) => s + i.amount, 0)
return (
<div className="flex w-full max-w-sm flex-col border">
{invoices.map((invoice) => (
<label
key={invoice.id}
className="flex cursor-pointer items-center gap-3 border-b px-4 py-3"
>
<Checkbox
checked={picked.includes(invoice.id)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked
? [...list, invoice.id]
: list.filter((id) => id !== invoice.id)
)
}
/>
<div className="flex-1">
<p className="font-sans text-xs">{invoice.id}</p>
<p
className={cn(
"text-xs",
invoice.overdue ? "text-destructive" : "text-muted-foreground"
)}
>
{invoice.due}
</p>
</div>
<span className="text-sm font-medium tabular-nums">
${invoice.amount.toLocaleString()}
</span>
</label>
))}
<div className="flex items-center justify-between gap-3 bg-muted/40 px-4 py-3">
<span className="text-sm">
Total{" "}
<span className="font-semibold tabular-nums">
${total.toLocaleString()}
</span>
</span>
<Button size="sm" disabled={total === 0}>
Pay now
</Button>
</div>
</div>
)
}
checkbox-34
Loading...
"use client"
import * as React from "react"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Checkbox } from "@/components/ui/checkbox"
const people = [
{ name: "Ali Imam", role: "Organizer", required: true },
{ name: "Omar", role: "Development" },
{ name: "Sara", role: "Design" },
{ name: "Lena", role: "Client" },
]
export function MeetingAttendeesPicker() {
const [invited, setInvited] = React.useState<string[]>(["Omar"])
return (
<div className="flex w-full max-w-xs flex-col gap-1">
<span className="mb-1 text-sm font-medium">Invite to Designali design review</span>
{people.map((person) => (
<label
key={person.name}
className="flex cursor-pointer items-center gap-3 px-2 py-1.5 hover:bg-muted"
>
<Avatar size="sm">
{person.name === "Ali Imam" ? (
<AvatarImage src="/ali.jpg" alt="Ali Imam" />
) : null}
<AvatarFallback>
{person.name
.split(" ")
.map((p) => p[0])
.join("")}
</AvatarFallback>
</Avatar>
<div className="min-w-0 flex-1">
<p className="truncate text-sm">{person.name}</p>
<p className="text-[11px] text-muted-foreground">{person.role}</p>
</div>
<Checkbox
checked={person.required || invited.includes(person.name)}
disabled={person.required}
onCheckedChange={(checked) =>
setInvited((list) =>
checked
? [...list, person.name]
: list.filter((n) => n !== person.name)
)
}
/>
</label>
))}
<span className="mt-1 text-xs text-muted-foreground">
{invited.length + 1} attendees
</span>
</div>
)
}
checkbox-35
Loading...
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldLabel,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"
export function RememberDeviceLogin() {
return (
<Card className="w-full max-w-xs">
<CardHeader>
<CardTitle>Two-factor authentication</CardTitle>
<CardDescription>
Enter the 6-digit code from your authenticator app.
</CardDescription>
</CardHeader>
<CardContent>
<form className="flex flex-col gap-4">
<Field>
<FieldLabel htmlFor="otp-code">Code</FieldLabel>
<Input
id="otp-code"
inputMode="numeric"
placeholder="000000"
className="font-sans tracking-widest"
/>
</Field>
<Field orientation="horizontal">
<Checkbox id="remember-device" name="remember" defaultChecked />
<FieldContent>
<FieldLabel htmlFor="remember-device">
Remember this device
</FieldLabel>
<FieldDescription>
Skip verification here for 30 days.
</FieldDescription>
</FieldContent>
</Field>
<Button type="submit">Verify</Button>
</form>
</CardContent>
</Card>
)
}
checkbox-36
Loading...
"use client"
import * as React from "react"
import {
Rocket as RocketIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field"
const steps = [
{ id: "tests", label: "All CI checks passed", hint: "142 tests, 0 failures" },
{
id: "migrations",
label: "Database migrations reviewed",
hint: "2 pending migrations",
},
{ id: "changelog", label: "Changelog updated", hint: "v4.8.0" },
{
id: "oncall",
label: "On-call engineer notified",
hint: "Ali is on call",
},
]
export function DeployChecklistGate() {
const [done, setDone] = React.useState<string[]>(["tests"])
const ready = done.length === steps.length
return (
<div className="flex w-full max-w-sm flex-col gap-3">
<FieldGroup className="gap-0 border">
{steps.map((step) => (
<Field
key={step.id}
orientation="horizontal"
className="border-b px-3 py-2.5 last:border-b-0"
>
<FieldContent>
<FieldLabel htmlFor={"deploy-" + step.id}>
{step.label}
</FieldLabel>
<FieldDescription>{step.hint}</FieldDescription>
</FieldContent>
<Checkbox
id={"deploy-" + step.id}
checked={done.includes(step.id)}
onCheckedChange={(checked) =>
setDone((list) =>
checked
? [...list, step.id]
: list.filter((s) => s !== step.id)
)
}
/>
</Field>
))}
</FieldGroup>
<Button disabled={!ready}>
<RocketIcon data-icon="inline-start" />
{ready
? "Deploy designali.com"
: done.length + "/" + steps.length + " checks complete"}
</Button>
</div>
)
}
checkbox-37
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldDescription,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
import { Input } from "@/components/ui/input"
const options = [
"Search engine",
"Friend or colleague",
"Podcast",
"Social media",
]
export function SurveyOtherOption() {
const [other, setOther] = React.useState(false)
return (
<FieldSet className="w-full max-w-xs">
<FieldLegend>How did you hear about Designali?</FieldLegend>
<FieldDescription>Select all that apply.</FieldDescription>
<FieldGroup className="gap-3">
{options.map((option) => (
<Field key={option} orientation="horizontal">
<Checkbox id={"source-" + option} name="source" value={option} />
<FieldLabel htmlFor={"source-" + option} className="font-normal">
{option}
</FieldLabel>
</Field>
))}
<Field orientation="horizontal">
<Checkbox
id="source-other"
checked={other}
onCheckedChange={setOther}
/>
<FieldLabel htmlFor="source-other" className="font-normal">
Other
</FieldLabel>
</Field>
{other && (
<Input
autoFocus
placeholder="Tell us where"
aria-label="Other source"
className="ms-6 w-auto"
/>
)}
</FieldGroup>
</FieldSet>
)
}
checkbox-38
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldLabel } from "@/components/ui/field"
export function ControlledStateReadout() {
const [checked, setChecked] = React.useState(false)
const [changes, setChanges] = React.useState(0)
const update = (value: boolean) => {
setChecked(value)
setChanges((c) => c + 1)
}
return (
<div className="flex w-full max-w-xs flex-col gap-4">
<Field orientation="horizontal">
<Checkbox
id="controlled-sync"
checked={checked}
onCheckedChange={update}
/>
<FieldLabel htmlFor="controlled-sync">Sync contacts</FieldLabel>
</Field>
<div className="flex gap-2">
<Button
size="sm"
variant="outline"
onClick={() => update(true)}
disabled={checked}
>
Check
</Button>
<Button
size="sm"
variant="outline"
onClick={() => update(false)}
disabled={!checked}
>
Uncheck
</Button>
<Button size="sm" variant="ghost" onClick={() => update(!checked)}>
Toggle
</Button>
</div>
<pre className="bg-muted p-3 font-mono text-xs">
{JSON.stringify({ checked, changes }, null, 2)}
</pre>
</div>
)
}
checkbox-39
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
const integrations = [
{ value: "slack", label: "Slack" },
{ value: "github", label: "GitHub" },
{ value: "linear", label: "Linear" },
{ value: "figma", label: "Figma" },
]
export function NativeFormDataSubmit() {
const [result, setResult] = React.useState<string[] | null>(null)
return (
<form
className="flex w-full max-w-xs flex-col gap-4"
onSubmit={(e) => {
e.preventDefault()
setResult(
new FormData(e.currentTarget).getAll("integrations").map(String)
)
}}
>
<FieldSet>
<FieldLegend variant="label">Connect integrations</FieldLegend>
<FieldGroup className="gap-3">
{integrations.map((item) => (
<Field key={item.value} orientation="horizontal">
<Checkbox
id={"int-" + item.value}
name="integrations"
value={item.value}
defaultChecked={item.value === "slack"}
/>
<FieldLabel htmlFor={"int-" + item.value} className="font-normal">
{item.label}
</FieldLabel>
</Field>
))}
</FieldGroup>
</FieldSet>
<Button type="submit" size="sm">
Save
</Button>
{result && (
<p className="font-sans text-xs text-muted-foreground">
integrations = [{result.join(", ")}]
</p>
)}
</form>
)
}
checkbox-40
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldLabel,
} from "@/components/ui/field"
import { Spinner } from "@/components/ui/spinner"
export function AsyncSavingCheckbox() {
const [checked, setChecked] = React.useState(false)
const [saving, setSaving] = React.useState(false)
const [savedAt, setSavedAt] = React.useState<string | null>(null)
const handleChange = (value: boolean) => {
setChecked(value)
setSaving(true)
setTimeout(() => {
setSaving(false)
setSavedAt(
new Date().toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
})
)
}, 1200)
}
return (
<Field
orientation="horizontal"
className="w-full max-w-xs"
data-disabled={saving || undefined}
>
<Checkbox
id="weekly-digest"
checked={checked}
disabled={saving}
onCheckedChange={handleChange}
/>
<FieldContent>
<FieldLabel htmlFor="weekly-digest">Weekly Designali digest email</FieldLabel>
<FieldDescription className="flex items-center gap-1.5">
{saving ? (
<>
<Spinner className="size-3" /> Saving...
</>
) : savedAt ? (
"Saved at " + savedAt
) : (
"Changes save automatically."
)}
</FieldDescription>
</FieldContent>
</Field>
)
}
checkbox-41
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { cn } from "@/lib/utils"
export function AccessibilityPreviewToggles() {
const [prefs, setPrefs] = React.useState({
large: false,
contrast: false,
underline: true,
})
const set = (key: keyof typeof prefs) => (value: boolean) =>
setPrefs((p) => ({ ...p, [key]: value }))
return (
<div className="flex w-full max-w-sm flex-col gap-4">
<FieldGroup className="gap-3">
<Field orientation="horizontal">
<Checkbox
id="a11y-large"
checked={prefs.large}
onCheckedChange={set("large")}
/>
<FieldLabel htmlFor="a11y-large">Larger text</FieldLabel>
</Field>
<Field orientation="horizontal">
<Checkbox
id="a11y-contrast"
checked={prefs.contrast}
onCheckedChange={set("contrast")}
/>
<FieldLabel htmlFor="a11y-contrast">High contrast</FieldLabel>
</Field>
<Field orientation="horizontal">
<Checkbox
id="a11y-underline"
checked={prefs.underline}
onCheckedChange={set("underline")}
/>
<FieldLabel htmlFor="a11y-underline">Underline links</FieldLabel>
</Field>
</FieldGroup>
<div
className={cn(
"border p-4 transition-all",
prefs.large ? "text-base" : "text-xs",
prefs.contrast ? "bg-foreground text-background" : "bg-muted/40"
)}
>
<p className="font-medium">Preview</p>
<p className={cn(!prefs.contrast && "text-muted-foreground")}>
Your Designali template is ready.{" "}
<a
href="#"
className={cn("font-medium", prefs.underline && "underline")}
>
Download files
</a>
</p>
</div>
</div>
)
}
checkbox-42
Loading...
"use client"
import * as React from "react"
import { Badge } from "@/components/ui/badge"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const subtasks = [
"Design hero block",
"Review with Ali",
"Add dark mode",
"Update Designali docs",
]
export function NestedSubtaskTree() {
const [done, setDone] = React.useState<string[]>(["Design hero block"])
const all = done.length === subtasks.length
return (
<div className="w-full max-w-xs border p-3">
<label className="flex items-center gap-2">
<Checkbox
checked={all}
indeterminate={done.length > 0 && !all}
onCheckedChange={(checked) => setDone(checked ? subtasks : [])}
className="data-indeterminate:border-primary data-indeterminate:bg-primary data-indeterminate:text-primary-foreground"
/>
<span
className={cn(
"text-sm font-medium",
all && "text-muted-foreground line-through"
)}
>
Public API v2
</span>
<Badge variant="secondary" className="ms-auto">
{done.length}/{subtasks.length}
</Badge>
</label>
<div className="ms-2 mt-2 flex flex-col gap-2 border-s ps-4">
{subtasks.map((task) => (
<label key={task} className="flex items-center gap-2 text-xs">
<Checkbox
checked={done.includes(task)}
onCheckedChange={(checked) =>
setDone((list) =>
checked ? [...list, task] : list.filter((t) => t !== task)
)
}
/>
<span
className={cn(
done.includes(task) && "text-muted-foreground line-through"
)}
>
{task}
</span>
</label>
))}
</div>
</div>
)
}
checkbox-43
Loading...
"use client"
import * as React from "react"
import {
Laptop as LaptopIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import { cn } from "@/lib/utils"
const laptops = [
{ name: "Portfolio Simple", price: "$49" },
{ name: "Design Agency", price: "$79" },
{ name: "Resort", price: "$59" },
{ name: "AI Starter", price: "$69" },
]
export function CompareProductsBar() {
const [compare, setCompare] = React.useState<string[]>([])
return (
<div className="flex w-full max-w-sm flex-col gap-2">
{laptops.map((laptop) => {
const checked = compare.includes(laptop.name)
const disabled = !checked && compare.length >= 3
return (
<div key={laptop.name} className="flex items-center gap-3 border p-3">
<div className="flex size-10 items-center justify-center bg-muted">
<LaptopIcon className="size-5 text-muted-foreground" />
</div>
<div className="flex-1">
<p className="text-sm font-medium">{laptop.name}</p>
<p className="text-xs text-muted-foreground">{laptop.price}</p>
</div>
<label
className={cn(
"flex items-center gap-2 text-xs",
disabled && "opacity-50"
)}
>
<Checkbox
checked={checked}
disabled={disabled}
onCheckedChange={(value) =>
setCompare((list) =>
value
? [...list, laptop.name]
: list.filter((n) => n !== laptop.name)
)
}
/>
Compare
</label>
</div>
)
})}
{compare.length > 0 && (
<div className="flex items-center justify-between bg-primary px-3 py-2 text-primary-foreground">
<span className="text-xs">{compare.length} of 3 selected</span>
<Button size="xs" variant="secondary" disabled={compare.length < 2}>
Compare now
</Button>
</div>
)}
</div>
)
}
checkbox-44
Loading...
"use client"
import * as React from "react"
import {
Download as DownloadIcon,
} from "@designali/icons"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
const tracks = [
{ title: "Colorful Spheres", artist: "Designali Motion", mb: 8.4 },
{ title: "Abstract Fluid", artist: "Designali Motion", mb: 9.1 },
{ title: "Studio Reel", artist: "Designali CGI", mb: 11.6 },
{ title: "Icon Animations", artist: "Designali Icons", mb: 7.2 },
]
export function OfflineDownloadTracks() {
const [picked, setPicked] = React.useState<string[]>(
tracks.map((t) => t.title)
)
const size = tracks
.filter((t) => picked.includes(t.title))
.reduce((s, t) => s + t.mb, 0)
return (
<div className="flex w-full max-w-sm flex-col border">
{tracks.map((track, index) => (
<label
key={track.title}
className="flex cursor-pointer items-center gap-3 border-b px-3 py-2 hover:bg-muted/50"
>
<span className="w-4 text-xs text-muted-foreground tabular-nums">
{index + 1}
</span>
<div className="min-w-0 flex-1">
<p className="truncate text-sm">{track.title}</p>
<p className="truncate text-xs text-muted-foreground">
{track.artist}
</p>
</div>
<span className="text-[11px] text-muted-foreground">
{track.mb} MB
</span>
<Checkbox
checked={picked.includes(track.title)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked
? [...list, track.title]
: list.filter((t) => t !== track.title)
)
}
/>
</label>
))}
<div className="flex items-center justify-between p-3">
<span className="text-xs text-muted-foreground">
{size.toFixed(1)} MB on device
</span>
<Button size="sm" disabled={picked.length === 0}>
<DownloadIcon data-icon="inline-start" />
Download {picked.length}
</Button>
</div>
</div>
)
}
checkbox-45
Loading...
import {
Mail as MailIcon,
MessageSquare as MessageSquareIcon,
Phone as PhoneIcon,
} from "@designali/icons"
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldGroup,
FieldLabel,
} from "@/components/ui/field"
const channels = [
{
id: "email",
icon: MailIcon,
label: "Email",
description: "Designali news and monthly design tips.",
},
{
id: "sms",
icon: MessageSquareIcon,
label: "Text messages",
description: "Project updates and template launches.",
},
{
id: "phone",
icon: PhoneIcon,
label: "Phone calls",
description: "Occasional account check-ins.",
},
]
export function MarketingConsentCard() {
return (
<Card className="w-full max-w-sm">
<CardHeader>
<CardTitle>Stay in touch</CardTitle>
<CardDescription>
Choose how Designali may contact you.
</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
<FieldGroup className="gap-3">
{channels.map((channel) => (
<Field key={channel.id} orientation="horizontal">
<Checkbox
id={"consent-" + channel.id}
name="consent"
value={channel.id}
defaultChecked={channel.id === "email"}
/>
<FieldContent>
<FieldLabel htmlFor={"consent-" + channel.id}>
<channel.icon className="size-3.5" />
{channel.label}
</FieldLabel>
<FieldDescription>{channel.description}</FieldDescription>
</FieldContent>
</Field>
))}
</FieldGroup>
<p className="text-[11px] leading-relaxed text-muted-foreground">
You can withdraw consent at any time from your account settings.
Message and data rates may apply.
</p>
</CardContent>
</Card>
)
}
checkbox-46
Loading...
"use client"
import * as React from "react"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
import { cn } from "@/lib/utils"
const aisles = [
{ name: "Brand", items: ["Logo", "Color palette", "Typography"] },
{ name: "UI", items: ["Wireframes", "Design system"] },
{ name: "Code", items: ["Next.js setup", "Tailwind config", "Vercel deploy"] },
]
export function GroceryListByAisle() {
const [got, setGot] = React.useState<string[]>(["Color palette", "Design system"])
return (
<div className="flex w-full max-w-xs flex-col gap-5">
{aisles.map((aisle) => {
const count = aisle.items.filter((i) => got.includes(i)).length
return (
<FieldSet key={aisle.name}>
<FieldLegend
variant="label"
className="flex w-full items-center justify-between"
>
{aisle.name}
<span className="font-normal text-muted-foreground">
{count}/{aisle.items.length}
</span>
</FieldLegend>
<FieldGroup className="gap-2.5">
{aisle.items.map((item) => (
<Field key={item} orientation="horizontal">
<Checkbox
id={"grocery-" + item}
checked={got.includes(item)}
onCheckedChange={(checked) =>
setGot((list) =>
checked
? [...list, item]
: list.filter((i) => i !== item)
)
}
/>
<FieldLabel
htmlFor={"grocery-" + item}
className={cn(
"font-normal",
got.includes(item) && "text-muted-foreground line-through"
)}
>
{item}
</FieldLabel>
</Field>
))}
</FieldGroup>
</FieldSet>
)
})}
</div>
)
}
checkbox-47
Loading...
"use client"
import * as React from "react"
import {
Folder as FolderIcon,
} from "@designali/icons"
import { Checkbox } from "@/components/ui/checkbox"
import { Progress, ProgressLabel } from "@/components/ui/progress"
import { cn } from "@/lib/utils"
const folders = [
{ name: "Templates", gb: 12.4 },
{ name: "CGI renders", gb: 48.9 },
{ name: "Client projects", gb: 21.3 },
{ name: "Icons", gb: 9.8 },
{ name: "Motion", gb: 6.1 },
]
const QUOTA = 100
export function BackupFolderPicker() {
const [picked, setPicked] = React.useState<string[]>([
"Templates",
"Client projects",
])
const used = folders
.filter((f) => picked.includes(f.name))
.reduce((s, f) => s + f.gb, 0)
const over = used > QUOTA * 0.8
return (
<div className="flex w-full max-w-xs flex-col gap-3">
<div className="flex flex-col gap-1 border">
{folders.map((folder) => (
<label
key={folder.name}
className="flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-muted/50"
>
<Checkbox
checked={picked.includes(folder.name)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked
? [...list, folder.name]
: list.filter((n) => n !== folder.name)
)
}
/>
<FolderIcon className="size-4 text-muted-foreground" />
<span className="flex-1 text-sm">{folder.name}</span>
<span className="text-xs text-muted-foreground tabular-nums">
{folder.gb} GB
</span>
</label>
))}
</div>
<Progress value={(used / QUOTA) * 100} aria-label="Backup storage">
<ProgressLabel className="text-xs">Cloud storage</ProgressLabel>
<span
className={cn(
"ms-auto text-xs tabular-nums",
over ? "text-destructive" : "text-muted-foreground"
)}
>
{used.toFixed(1)} / {QUOTA} GB
</span>
</Progress>
</div>
)
}
checkbox-48
Loading...
import { Checkbox } from "@/components/ui/checkbox"
import { Field, FieldGroup, FieldLabel } from "@/components/ui/field"
import { Kbd, KbdGroup } from "@/components/ui/kbd"
const prefs = [
{ id: "wrap", label: "Word wrap", keys: ["Alt", "Z"], on: true },
{ id: "minimap", label: "Show minimap", keys: ["Ctrl", "M"], on: false },
{ id: "lines", label: "Line numbers", keys: ["Ctrl", "L"], on: true },
{ id: "zen", label: "Zen mode", keys: ["Ctrl", "K", "Z"], on: false },
]
export function ShortcutPreferenceList() {
return (
<FieldGroup className="w-full max-w-xs gap-3">
{prefs.map((pref) => (
<Field key={pref.id} orientation="horizontal">
<Checkbox id={"pref-" + pref.id} defaultChecked={pref.on} />
<FieldLabel
htmlFor={"pref-" + pref.id}
className="flex-1 font-normal"
>
{pref.label}
</FieldLabel>
<KbdGroup>
{pref.keys.map((key) => (
<Kbd key={key}>{key}</Kbd>
))}
</KbdGroup>
</Field>
))}
</FieldGroup>
)
}
checkbox-49
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldContent,
FieldDescription,
FieldLabel,
} from "@/components/ui/field"
const clauses = [
"1. You may install the software on up to three devices you own.",
"2. You may not resell, sublicense, or distribute the software.",
"3. Updates are provided for twelve months from purchase.",
"4. We collect anonymous crash reports to improve stability.",
"5. The software is provided as is, without warranty of any kind.",
"6. This agreement is governed by the laws of your country of residence.",
"7. Either party may terminate this agreement with written notice.",
]
export function ScrollToAcceptAgreement() {
const [reachedEnd, setReachedEnd] = React.useState(false)
const [accepted, setAccepted] = React.useState(false)
return (
<div className="flex w-full max-w-sm flex-col gap-3">
<div
className="h-36 overflow-y-auto border bg-muted/30 p-3 text-xs leading-relaxed"
onScroll={(e) => {
const el = e.currentTarget
if (el.scrollTop + el.clientHeight >= el.scrollHeight - 4)
setReachedEnd(true)
}}
>
<p className="mb-2 font-medium">End user license agreement</p>
{clauses.map((clause) => (
<p key={clause} className="mb-2 text-muted-foreground">
{clause}
</p>
))}
</div>
<Field orientation="horizontal" data-disabled={!reachedEnd || undefined}>
<Checkbox
id="eula-accept"
disabled={!reachedEnd}
checked={accepted}
onCheckedChange={setAccepted}
/>
<FieldContent>
<FieldLabel htmlFor="eula-accept">
I have read and accept the agreement
</FieldLabel>
{!reachedEnd && (
<FieldDescription>Scroll to the end to continue.</FieldDescription>
)}
</FieldContent>
</Field>
<Button disabled={!accepted}>Install</Button>
</div>
)
}
checkbox-50
Loading...
"use client"
import * as React from "react"
import { Button } from "@/components/ui/button"
import { Checkbox } from "@/components/ui/checkbox"
import {
Field,
FieldDescription,
FieldError,
FieldGroup,
FieldLabel,
FieldLegend,
FieldSet,
} from "@/components/ui/field"
const reasons = [
"Too expensive",
"Missing features",
"Switching to another tool",
"No longer needed",
]
export function AtLeastOneRequired() {
const [picked, setPicked] = React.useState<string[]>([])
const [touched, setTouched] = React.useState(false)
const invalid = touched && picked.length === 0
return (
<form
className="flex w-full max-w-xs flex-col gap-4"
onSubmit={(e) => {
e.preventDefault()
setTouched(true)
}}
>
<FieldSet data-invalid={invalid || undefined}>
<FieldLegend>Why are you cancelling Designali Pro?</FieldLegend>
<FieldDescription>Select at least one reason.</FieldDescription>
<FieldGroup className="gap-3">
{reasons.map((reason) => (
<Field
key={reason}
orientation="horizontal"
data-invalid={invalid || undefined}
>
<Checkbox
id={"reason-" + reason}
aria-invalid={invalid || undefined}
checked={picked.includes(reason)}
onCheckedChange={(checked) =>
setPicked((list) =>
checked
? [...list, reason]
: list.filter((r) => r !== reason)
)
}
/>
<FieldLabel htmlFor={"reason-" + reason} className="font-normal">
{reason}
</FieldLabel>
</Field>
))}
</FieldGroup>
{invalid && <FieldError>Please choose at least one reason.</FieldError>}
</FieldSet>
<Button type="submit" variant="destructive">
Cancel subscription
</Button>
</form>
)
}
Categories
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Avatar
- Badge
- Breadcrumb
- Button
- Calendar
- Card
- Carousel
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Dialog
- Drawer
- Dropdown Menu
- Field
- Hover Card
- Input
- Input OTP
- Label
- Menubar
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip