Settings List
Titled groups of settings. Each row names a setting, explains it, and puts its value or control beside it.
Installation
pnpm dlx shadcn@latest add https://sprout.tulipfarm.ai/r/settings-list.jsonCopies Settings List into your app, installs the packages, and adds the styles. Then import it from @/components/ui/settings-list. Needs Tailwind CSS 4 and a components.json from shadcn init.
Install the following dependencies:
pnpm add clsx tailwind-mergeAdd Sprout base once per app: the
cn()helper and the design tokens.lib/sprout/classes.ts- Design tokens, for your global CSS
Copy and paste the following code into your project.
import type { ComponentProps, ReactNode } from 'react'; import { cn } from '@/lib/sprout/classes'; export const settingsGroupHeadingNames = ['h2', 'h3', 'h4'] as const; export type SettingsGroupHeading = (typeof settingsGroupHeadingNames)[number]; export interface SettingsGroupProps extends Omit<ComponentProps<'section'>, 'title'> { title: ReactNode; titleId?: string; heading?: SettingsGroupHeading; } export function SettingsGroup({ title, titleId, heading: Heading = 'h2', className, children, ...props }: SettingsGroupProps) { return ( <section data-slot="settings-group" aria-labelledby={titleId} className={cn('sprout-settings-group', className)} {...props} > <Heading id={titleId} className="sprout-settings-group-title"> {title} </Heading> <div data-slot="settings-group-content" className="sprout-settings-group-content"> {children} </div> </section> ); } export interface SettingsRowProps extends Omit<ComponentProps<'div'>, 'children'> { label: ReactNode; description?: ReactNode; htmlFor?: string; children?: ReactNode; } export function SettingsRow({ label, description, htmlFor, className, children, ...props }: SettingsRowProps) { return ( <div data-slot="settings-row" className={cn('sprout-settings-row', className)} {...props}> <div className="sprout-settings-row-text"> {htmlFor ? ( <label htmlFor={htmlFor} className="sprout-settings-row-label"> {label} </label> ) : ( <p className="sprout-settings-row-label">{label}</p> )} {description != null && description !== false && description !== '' && ( <div className="sprout-settings-row-description">{description}</div> )} </div> {children != null && children !== false && ( <div data-slot="settings-row-control" className="sprout-settings-row-control"> {children} </div> )} </div> ); }Add the styles to your global CSS, after
@import "tailwindcss".@layer components { .sprout-settings-group { --sprout-settings-row-inline: 1rem; --sprout-settings-row-block: .75rem; min-width: 0; color: var(--sprout-text); font-family: var(--sprout-font); gap: .5rem; display: grid; } .sprout-settings-group-title { color: var(--sprout-text); font-size: var(--sprout-text-sm); letter-spacing: normal; margin: 0; font-weight: 500; line-height: 1.25rem; } .sprout-settings-group-content { border: 1px solid var(--sprout-line); border-radius: var(--sprout-radius-panel); background: var(--sprout-surface); min-width: 0; container: sprout-settings / inline-size; } :where(.sprout-settings-group-content > :not([hidden]) ~ :not([hidden])) { border-top: 1px solid var(--sprout-line); } .sprout-settings-row { min-width: 0; padding: var(--sprout-settings-row-block, .75rem) var(--sprout-settings-row-inline, 1rem); flex-direction: column; gap: .75rem; display: flex; } .sprout-settings-row-text { overflow-wrap: anywhere; gap: .125rem; min-width: 0; display: grid; } .sprout-settings-row-label { color: var(--sprout-text); font-size: var(--sprout-text-sm); margin: 0; font-weight: 500; line-height: 1.25rem; display: block; } .sprout-settings-row-description { color: var(--sprout-muted); font-size: var(--sprout-text-xs); line-height: 1rem; } .sprout-settings-row-control { min-width: 0; color: var(--sprout-text); font-size: var(--sprout-text-sm); flex-wrap: wrap; flex-shrink: 0; align-items: center; gap: .5rem; line-height: 1.25rem; display: flex; } @container sprout-settings (width >= 36rem) { .sprout-settings-row { flex-direction: row; justify-content: space-between; align-items: center; } .sprout-settings-row-control { justify-content: flex-end; max-width: 60%; } } }Import it from
@/components/ui/settings-list. Update the paths if your@/alias points elsewhere.
pnpm add @tulipfarm/sprout@import "tailwindcss";
@import "@tulipfarm/sprout/styles.css";The package keeps the source and ships fixes with each release. Import from @tulipfarm/sprout/settings-list.
Profile
Picture
Sign-in methods
Google · Email link
Preferences
Theme
Analytics
Usage
import { SettingsGroup, SettingsRow } from "@tulipfarm/sprout/settings-list";
<SettingsGroup title="Profile" titleId="profile-heading">
<SettingsRow label="Email" description="Used to sign in.">
<span className="break-all">{user.email}</span>
</SettingsRow>
<SettingsRow
label="Name"
htmlFor="account-name"
description={<span id="account-name-help">Up to 80 characters.</span>}
>
<Input id="account-name" aria-describedby="account-name-help" />
</SettingsRow>
</SettingsGroup>SettingsGroup renders a section with a title and a bordered panel. Pass titleId to name the section by its title; leave it out for lists that repeat, like one group per table. The title is anh2; set heading to "h3" or "h4" when the group sits under another heading.
SettingsRow takes a label, an optionaldescription, and children for the value or control. WithhtmlFor, the label is a real label, so clicking it focuses the control. A row without children has no control area, which suits read-only facts like a role or a directory entry.
Rows
Rows stack text over the control in narrow groups. From 36rem of group width, the control moves to the right and takes at most 60% of the row. Controls wrap; long text and codes break instead of overflowing.
Workspace identity
Role
Workspace name
Northwind Logistics
Role
Workspace URL
https://app.tulipfarm.example/northwind-logistics-international-operationsWorkspace directory
Maya Chen
Arjun Rao
Notes, forms, and alerts
<SettingsGroup title="Workspace identity" titleId="identity-heading">
{!admin && <p className="px-[var(--sprout-settings-row-inline)] py-[var(--sprout-settings-row-block)]">
Only workspace admins can rename or close this workspace.
</p>}
<form onSubmit={save}>
<SettingsRow label="Workspace name" htmlFor="workspace-name">…</SettingsRow>
{dirty && <div className="flex justify-end gap-2 px-4 pb-3">…</div>}
</form>
{saved && <p role="status">Workspace name saved.</p>}
</SettingsGroup>Any child can sit in a group, and every child gets a divider above it. Children that render nothing add no divider. Notes and blocks can match row padding with --sprout-settings-row-inline and--sprout-settings-row-block. Pick the Workspace and Account pages in the playground to see forms, save messages, a conflict alert, and loading or error states inside rows.
Accessibility
Name controls with htmlFor, or pass your ownlabel element as the label. Link help text witharia-describedby by giving the description an id. The list has no motion of its own. Switches, checkboxes, the text field, and the theme toggle in these examples are docs-only stand-ins; data and saving are sample code.