Skip to content
  1. Keyline UI
  2. Item
Keyline UIComponents
  • Get started
    • Installation
    • Theming
    • Modes
    • Configuration
    • Composition
  • Actions
    • Button
    • Button group
    • Split button
    • Toggle
    • Toggle group
    • Toolbar
    • Menu
    • Menubar
    • Context menu
  • Inputs
    • Field and form
    • Checkbox
    • Checkbox group
    • Radio group
    • Switch
    • Slider
    • Segmented
    • Select
    • Native select
    • Combobox
    • Multiselect
    • Number field
    • OTP field
    • Time field
    • Date picker and calendar
    • Date range
  • Data
    • Table
    • Chart
    • Stat and meter
    • Status and badge
    • Progress
    • Skeleton
    • Empty
    • Avatar
    • Kbd
    • Marker
  • Navigation
    • Tabs
    • Breadcrumb
    • Pagination
    • Nav
    • Navigation menu
    • Command menu
  • Overlays
    • Dialog
    • Alert dialog
    • Drawer
    • Sheet
    • Popover
    • Hover card
    • Tooltip
    • Toast
    • Notice
  • Layout
    • App shell
    • Sidebar
    • Panel
    • Resizable
    • Scroll area
    • Accordion
    • Collapsible
    • Carousel
    • Inspector
    • Item
    • Direction
  • Conversation
    • Message
    • Bubble
    • Message scroller
    • Attachment
    • Questionnaire
  • Blocks
    • Shipments

Item

A list of rows on shared keylines: a square media cell, the content, a value and the row's controls. Pass render to make the whole row a link or a button, and current to mark the one that is open.

Loading the live example…

"use client"

import { useState } from "react"
import { Item, ItemActions, ItemContent, ItemList, ItemMedia } from "@/components/keyline/ui/item"
import { Switch } from "@/components/keyline/ui/switch"

const ALERTS = [
  { id: "new", code: "ORD", title: "New orders", desc: "When a client places an order through the website." },
  { id: "held", code: "DLV", title: "Held deliveries", desc: "When Darryl can't get a signature." },
  { id: "low", code: "STK", title: "Low paper stock", desc: "When a grade drops under a week's deliveries." },
  { id: "party", code: "PTY", title: "Party planning", desc: "Every message from the committee." },
]

export function AlertSettings() {
  const [on, setOn] = useState<Record<string, boolean>>({ new: true, held: true, low: false, party: false })
  return (
    <ItemList aria-label="Email me about">
      {ALERTS.map((a) => (
        <Item key={a.id}>
          <ItemMedia>{a.code}</ItemMedia>
          <ItemContent title={<span id={`alert-${a.id}`}>{a.title}</span>} description={a.desc} />
          <ItemActions>
            <Switch aria-labelledby={`alert-${a.id}`} checked={on[a.id]} onCheckedChange={(v) => setOn((s) => ({ ...s, [a.id]: v }))} />
          </ItemActions>
        </Item>
      ))}
    </ItemList>
  )
}

Installation

npx shadcn@latest add @keyline-ui/item

Run it where your components.json is. The first time, map the @keyline-ui registry: one command, in Installation.

Usage

import { Item, ItemActions, ItemContent, ItemList, ItemMedia, ItemMeta } from "@/components/keyline/ui/item"
<ItemList aria-label="Email me about">
  <Item>
    <ItemMedia>ORD</ItemMedia>
    <ItemContent title="New orders" description="…" />
    <ItemActions><Switch aria-label="New orders" /></ItemActions>
  </Item>
</ItemList>

Props

PropTypeDefaultDescription
layout"control" | "cell"Default "control"On ItemList: cell is the body of an enclosing frame.
renderReactElementDefault —On Item: <a href> or <button> makes the row interactive.
currentbooleanDefault falseOn Item: the row that is open; its media cell floods.
ItemMediaspanDefault —A 16px icon, an initial or a code of up to four characters.
title · descriptionReactNodeDefault —On ItemContent.
ItemMeta · ItemActionsspanDefault —A trailing value in the code voice, and the row&apos;s controls.

The Inspector, Resizable and Scroll area examples use clickable Item rows.

Sheet 66 of 73PreviousInspectorNextDirection
On this page