{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "settings-list",
  "type": "registry:block",
  "title": "Settings list",
  "description": "Grouped settings rows in flat Cards, like iOS Settings: toggles (Switch), choices (Select), links to deeper screens with the current value, and actions such as 'Log out' or a destructive 'Delete account'.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://unbuiltui.com/r/card.json",
    "https://unbuiltui.com/r/list.json",
    "https://unbuiltui.com/r/select.json",
    "https://unbuiltui.com/r/switch.json",
    "https://unbuiltui.com/r/utils.json"
  ],
  "files": [
    {
      "path": "components/blocks/settings-list.tsx",
      "type": "registry:component",
      "target": "components/blocks/settings-list.tsx",
      "content": "\"use client\";\n\nimport { ChevronRightIcon } from \"lucide-react\";\nimport type * as React from \"react\";\nimport { Card, CardContent } from \"@/components/ui/card\";\nimport { List, ListItem } from \"@/components/ui/list\";\nimport {\n  Select,\n  SelectContent,\n  SelectItem,\n  SelectTrigger,\n  SelectValue,\n} from \"@/components/ui/select\";\nimport { Switch } from \"@/components/ui/switch\";\nimport { cn } from \"@/lib/utils\";\n\n// UnbuiltUI block: grouped settings rows. Each row is a toggle, a choice, a link to a\n// deeper screen or a destructive action; groups sit in flat cards with a small heading.\n\ntype BaseRow = {\n  id: string;\n  label: string;\n  description?: string;\n  icon?: React.ReactNode;\n  disabled?: boolean;\n};\n\nexport type SettingsRow =\n  | (BaseRow & { type: \"toggle\"; checked: boolean })\n  | (BaseRow & { type: \"select\"; value: string; options: { value: string; label: string }[] })\n  | (BaseRow & { type: \"link\"; value?: string })\n  | (BaseRow & { type: \"action\"; destructive?: boolean });\n\nexport type SettingsGroup = { id: string; title?: string; rows: SettingsRow[] };\n\ntype SettingsListProps = {\n  groups: SettingsGroup[];\n  /** Toggle and select rows report their new value; link and action rows report `undefined`. */\n  onChange?: (row: SettingsRow, value?: boolean | string) => void;\n  className?: string;\n};\n\nfunction SettingsList({ groups, onChange, className }: SettingsListProps) {\n  return (\n    <div data-slot=\"settings-list\" className={cn(\"flex w-full flex-col gap-6\", className)}>\n      {groups.map((group) => (\n        <section key={group.id} className=\"flex flex-col gap-2\">\n          {group.title && (\n            <h2 className=\"px-1 font-medium text-muted-foreground text-xs uppercase tracking-wide\">\n              {group.title}\n            </h2>\n          )}\n          <Card className=\"py-1\">\n            <CardContent className=\"px-4\">\n              <List>\n                {group.rows.map((row) => (\n                  <SettingsItem key={row.id} row={row} onChange={onChange} />\n                ))}\n              </List>\n            </CardContent>\n          </Card>\n        </section>\n      ))}\n    </div>\n  );\n}\n\nfunction SettingsItem({\n  row,\n  onChange,\n}: {\n  row: SettingsRow;\n  onChange?: SettingsListProps[\"onChange\"];\n}) {\n  const leading = row.icon && (\n    <span className=\"flex size-9 items-center justify-center rounded-sm bg-muted text-muted-foreground [&_svg]:size-[18px]\">\n      {row.icon}\n    </span>\n  );\n  const common = { leading, title: row.label, description: row.description };\n\n  if (row.type === \"toggle\") {\n    return (\n      <ListItem\n        {...common}\n        trailing={\n          <Switch\n            checked={row.checked}\n            disabled={row.disabled}\n            aria-label={row.label}\n            onCheckedChange={(checked) => onChange?.(row, checked)}\n          />\n        }\n      />\n    );\n  }\n  if (row.type === \"select\") {\n    return (\n      <ListItem\n        {...common}\n        trailing={\n          <Select\n            value={row.value}\n            disabled={row.disabled}\n            onValueChange={(value) => onChange?.(row, value)}\n          >\n            <SelectTrigger\n              size=\"sm\"\n              aria-label={row.label}\n              className=\"w-auto min-w-28 bg-transparent\"\n            >\n              <SelectValue />\n            </SelectTrigger>\n            <SelectContent align=\"end\">\n              {row.options.map((option) => (\n                <SelectItem key={option.value} value={option.value}>\n                  {option.label}\n                </SelectItem>\n              ))}\n            </SelectContent>\n          </Select>\n        }\n      />\n    );\n  }\n  if (row.type === \"link\") {\n    return (\n      <ListItem\n        {...common}\n        interactive\n        disabled={row.disabled}\n        onClick={() => onChange?.(row)}\n        trailing={\n          <span className=\"flex items-center gap-1 text-muted-foreground text-sm\">\n            {row.value}\n            <ChevronRightIcon aria-hidden=\"true\" className=\"size-4\" />\n          </span>\n        }\n      />\n    );\n  }\n  return (\n    <ListItem\n      {...common}\n      interactive\n      disabled={row.disabled}\n      onClick={() => onChange?.(row)}\n      className={cn(row.destructive && \"text-destructive\")}\n    />\n  );\n}\n\nexport { SettingsList };\n"
    }
  ]
}
