suiss/ui
  • Docs
  • Components
  • Patterns
  • Interactions
  • Charts
  • Blocks
  • AI
GitHubCreate
DocsComponentsPatternsInteractionsChartsBlocksAICreate
Components84
  • Overview
  • Accordion
  • Alert
  • Alert Dialog
  • Alert Sheet
  • Amount Input
  • Aspect Ratio
  • Attachment
  • Avatar
  • Badge
  • Bottom Bar
  • Breadcrumb
  • Bubble
  • Button
  • Button Group
  • Calendar
  • Card
  • Carousel
  • Chart
  • Checkbox
  • Chip
  • Code Block
  • Collapsible
  • Combobox
  • Command
  • Context Menu
  • Dialog
  • Direction
  • Drawer
  • Dropdown Menu
  • Empty
  • FAB
  • Field
  • Fullscreen Menu
  • Haptics
  • Header
  • Hover Card
  • Icon
  • Input
  • Input Accessory Bar
  • Input Group
  • Input OTP
  • Item
  • Kbd
  • Keyboard Scroll View
  • Keypad
  • Label
  • Marker
  • Menubar
  • Message
  • Message Scroller
  • Native Select
  • Navigation Menu
  • Page Indicator
  • Pagination
  • Pin Pad
  • Popover
  • Progress
  • QR Scanner
  • Questionnaire
  • Radio Group
  • Resizable
  • Screen
  • Scroll Area
  • Select
  • Separator
  • Sheet
  • Sidebar
  • Signature Pad
  • Skeleton
  • Slider
  • Spinner
  • Switch
  • Tab Bar
  • Table
  • Tabs
  • Text
  • Textarea
  • Toast
  • Toggle
  • Toggle Group
  • Tooltip
  • Trace
  • Wheel Picker
  • Widget

suiss/ui · Component

Item

A flexible row that pairs media, a title, a description and actions, for lists and settings.

Item is an open-source component from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.

import { ShieldCheckIcon } from "@phosphor-icons/react"
import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemDemo() {
  return (
    <Item variant="outline" className="w-96">
      <ItemMedia variant="icon">
        <ShieldCheckIcon />

Item is a row container. Inside it, ItemMedia holds an icon, image or avatar, ItemContent stacks an ItemTitle and ItemDescription, and ItemActions holds buttons or indicators at the end. ItemHeader and ItemFooter span the full width of the item, above and below the main row. The whole item can also render as a link or button.

ItemGroup stacks items as a list, and ItemSeparator divides them. Use items to display content; for form controls with labels and validation, use Field.

Installation

$ pnpm dlx shadcn@latest add @esuiss/item

Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add item
  1. Install the following dependencies and add the cn helper:
$ pnpm add @base-ui/react class-variance-authority
  1. Copy and paste the following code into your project.
components/ui/item.tsx
import { mergeProps } from "@base-ui/react/merge-props"
import { useRender } from "@base-ui/react/use-render"
import { cva, type VariantProps } from "class-variance-authority"
import type * as React from "react"
import { cn } from "@/lib/utils"

function ItemGroup({
  className,
  variant = "default",
  ...props
}: React.ComponentProps<"div"> & { variant?: "default" | "inset" }) {
  return (
    <div
      role="list"
      data-slot="item-group"
      data-variant={variant}
  1. Update the import paths to match your project setup.

Usage

import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemFooter,
  ItemGroup,
  ItemHeader,
  ItemMedia,
  ItemSeparator,
  ItemTitle,
} from "@/components/ui/item"
<div className="w-96">
  <Item variant="outline">
    <ItemMedia variant="icon">
      <ShieldCheckIcon />
    </ItemMedia>
    <ItemContent>
      <ItemTitle>Two-factor authentication</ItemTitle>
      <ItemDescription>
        Add an extra layer of security to your account.
      </ItemDescription>
    </ItemContent>
    <ItemActions>
      <Button variant="outline" size="sm">
        Enable
      </Button>
    </ItemActions>
  </Item>
</div>

Composition

Use the following composition to build a Item:

Item
├── ItemMedia
├── ItemContent
│   ├── ItemTitle
│   └── ItemDescription
├── ItemActions
├── ItemHeader
│   └── ItemTitle
└── ItemFooter
ItemGroup
├── ItemSeparator
└── Item
    ├── ItemMedia
    ├── ItemContent
    │   ├── ItemTitle
    │   └── ItemDescription
    └── ItemActions

Examples

Variants

Use the variant prop for the item's border and background: default has neither, outline adds a border and muted adds a subtle background.

import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemVariants() {
  return (
    <div className="flex w-96 flex-col gap-4">
      <Item variant="default">
        <ItemContent>
          <ItemTitle>Default item</ItemTitle>
          <ItemDescription>

Sizes

Use the size prop to set the padding and gap: default is the roomiest, then sm, then xs. A group of sm or xs items is spaced more tightly.

import { CaretRightIcon, CheckCircleIcon } from "@phosphor-icons/react"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemSizes() {
  return (
    <div className="flex w-96 flex-col gap-4">
      <Item variant="outline" size="default">
        <ItemMedia variant="icon">
          <CheckCircleIcon />
        </ItemMedia>

As link

Use the render prop to render the whole item as a link or button, so the row is one focusable target. A linked item gets the accent background on hover.

Set asChild and pass a link or button as the child to render the whole item as it, so the row is one focusable target. A linked item gets the accent background on hover.

Pass a render function that returns a link or button and spread the props it receives onto it, so the row is one focusable target. A linked item gets the accent background on hover.

import { BellIcon, CaretRightIcon } from "@phosphor-icons/react"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemAsLink() {
  return (
    <Item
      variant="outline"
      className="w-96"
      render={<a href="#notifications" />}

With image

Set variant="image" on ItemMedia to crop an image into a rounded square that scales with the item size. This list of people adds separators and an invite button on each row.

import { PlusIcon } from "@phosphor-icons/react"
import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemSeparator,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemWithImage() {
  return (
    <ItemGroup className="w-96">

Inset

Set variant="inset" on ItemGroup to group the items into a rounded list on bg-muted, with square item corners and separators inset from the start.

import { PlusIcon } from "@phosphor-icons/react"
import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemSeparator,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemInset() {
  return (
    <ItemGroup variant="inset" className="w-96">

With avatar

An item with an Avatar as media and a Message button.

import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Button } from "@/components/ui/button"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemWithAvatar() {
  return (
    <Item variant="outline" className="w-96">
      <ItemMedia>
        <Avatar size="lg">

With header and footer

A plan summary with a price in the header and a renewal date and action in the footer.

import { Button } from "@/components/ui/button"
import {
  Item,
  ItemContent,
  ItemDescription,
  ItemFooter,
  ItemHeader,
  ItemTitle,
} from "@/components/ui/item"

export default function ItemWithHeaderAndFooter() {
  return (
    <Item variant="outline" className="w-96">
      <ItemHeader>
        <ItemTitle>Pro plan</ItemTitle>
        <span className="text-sm font-medium">$24/mo</span>

Accessibility

  • ItemGroup has the list role; give each Item in it the listitem role.
  • ItemSeparator has the none role, so it is ignored by assistive technology.
  • An item rendered as a link or button is a single focusable element and shows a focus ring.
  • Give icon-only action buttons an accessible name with aria-label.

API Reference

ItemGroup

Stacks items as a list, or groups them into an inset list.

PropTypeDefault
variant"default" | "inset""default"

Also accepts the props of React.ComponentProps<"div">.

The group has the list role, so set role="listitem" on each Item inside it.

ItemSeparator

A divider between items.

Also accepts the props of React.ComponentProps<"div">.

Item

The row container for media, content and actions.

PropTypeDefault
variant"default" | "outline" | "muted""default"
size"default" | "sm" | "xs""default"

Also accepts the props of useRender.ComponentProps<"div">.

PropTypeDefault
asChildbooleanfalse

Also accepts the props of React.ComponentProps<"div">.

PropTypeDefault
render(props) => React.ReactNode-

Also accepts the props of React.ComponentProps<"div">.

Item sets data-variant and data-size for styling.

ItemMedia

Holds an icon, image or avatar at the start of the item.

PropTypeDefault
variant"default" | "icon" | "image""default"

Also accepts the props of React.ComponentProps<"div">.

icon sizes an icon, image crops an image into a rounded square, and default renders the media as is. When ItemDescription is present, the media aligns to the top of the item instead of its center.

ItemContent

Stacks the title and description.

Also accepts the props of React.ComponentProps<"div">.

ItemTitle

The item's title, limited to one line.

Also accepts the props of React.ComponentProps<"div">.

ItemDescription

Supporting text, limited to two lines.

Also accepts the props of React.ComponentProps<"p">.

ItemActions

Holds buttons or indicators at the end of the item.

Also accepts the props of React.ComponentProps<"div">.

ItemHeader

A full-width row above the item's content.

Also accepts the props of React.ComponentProps<"div">.

ItemFooter

A full-width row below the item's content.

Also accepts the props of React.ComponentProps<"div">.

Each part sets a data-slot, such as item-media or item-title, for styling.

Web

Web preview

import { CaretRightIcon, ShieldCheckIcon } from "phosphor-react-native"
import { View } from "react-native"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Icon } from "@/components/ui/icon"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemFooter,
  ItemHeader,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"
import { Text } from "@/components/ui/text"
import { CaretRightIcon, ShieldCheckIcon } from "phosphor-react-native"
import { View } from "react-native"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Icon } from "@/components/ui/icon"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemFooter,
  ItemHeader,
  ItemMedia,
  ItemTitle,
} from "@/components/ui/item"
import { Text } from "@/components/ui/text"
import PhosphorSwift
import SwiftUI

struct ItemExample: View {
  var body: some View {
    VStack(alignment: .leading, spacing: 16) {
      Item(.outline) {
        ItemContent {
          ItemTitle("Basic item")
          ItemDescription("A simple item with a title and a description.")
        }
        ItemActions {
          Button("Action") {}
            .buttonStyle(.variant(.outline, size: .sm))
        }
      }
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.adamglin.PhosphorIcons
import com.adamglin.phosphoricons.Regular
import com.adamglin.phosphoricons.regular.CaretRight
import com.adamglin.phosphoricons.regular.ShieldCheck
import com.esuiss.ui.components.Badge
import com.esuiss.ui.components.Button
import com.esuiss.ui.components.ButtonSize
import com.esuiss.ui.components.ButtonVariant
import com.esuiss.ui.components.Icon
import com.esuiss.ui.components.Item

Item is a row that renders as a Pressable with the button role when it has onPress or onLongPress, and as a plain View with the listitem role otherwise. It has three variants (default, outline, muted) and three sizes (default, sm, xs).

Compose a row from ItemMedia, ItemContent (holding ItemTitle and ItemDescription) and ItemActions. Use ItemHeader and ItemFooter for full-width rows above or below the main content.

ItemGroup stacks items as a list. Its inset variant joins them into one rounded card with square inner corners, which suits settings screens; add ItemSeparator between rows to draw an inset divider.

Installation

$ pnpm dlx shadcn@latest add @esuiss/item

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add item
$ pnpm dlx shadcn@latest add @esuiss/item

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add item --platform swift
$ pnpm dlx shadcn@latest add @esuiss/item

See Installation for the components.json setup. Or use the suiss/ui CLI:

$ pnpm dlx @esuiss/ui@latest add item --platform kotlin

The CLI also adds what it builds on: Icon, Text.

  1. Install the following dependencies:
npx expo install class-variance-authority cn
  1. Add the pieces it builds on: Icon, Text.

  2. Copy the primitives it uses into components/primitives:

uniwind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
uniwind/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
uniwind/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
uniwind/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/item.tsx:
uniwind/components/ui/item.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import * as React from "react"
import { Pressable, View, type ViewProps } from "react-native"
import type { RenderProp } from "@/components/primitives/types"
import { useRender } from "@/components/primitives/use-render"
import { IconClassContext } from "@/components/ui/icon"
import { Text, TextClassContext } from "@/components/ui/text"

type ItemSize = "default" | "sm" | "xs"

const ItemGroupContext = React.createContext<{ inset: boolean }>({
  inset: false,
})

const ItemContext = React.createContext<{ size: ItemSize }>({
  1. Update the import paths to match your project setup.
  1. Install the following dependencies:
npx expo install class-variance-authority cn
  1. Add the pieces it builds on: Icon, Text.

  2. Copy the primitives it uses into components/primitives:

nativewind/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
nativewind/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
nativewind/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
nativewind/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/item.tsx:
nativewind/components/ui/item.tsx
import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "cn"
import * as React from "react"
import { Pressable, View, type ViewProps } from "react-native"
import type { RenderProp } from "@/components/primitives/types"
import { useRender } from "@/components/primitives/use-render"
import { IconClassContext } from "@/components/ui/icon"
import { Text, TextClassContext } from "@/components/ui/text"

type ItemSize = "default" | "sm" | "xs"

const ItemGroupContext = React.createContext<{ inset: boolean }>({
  inset: false,
})

const ItemContext = React.createContext<{ size: ItemSize }>({
  1. Update the import paths to match your project setup.
  1. Add the pieces it builds on: Icon, Text.

  2. Copy the primitives it uses into components/primitives:

stylesheet/components/primitives/hooks.ts
import * as React from "react"
import { BackHandler } from "react-native"

function useEffectEvent<TArgs extends readonly unknown[], TResult>(
  callback: (...args: TArgs) => TResult
): (...args: TArgs) => TResult {
  const callbackRef = React.useRef(callback)

  React.useLayoutEffect(() => {
    callbackRef.current = callback
  })

  return React.useCallback(
    (...args: TArgs): TResult => callbackRef.current(...args),
    []
  )
stylesheet/components/primitives/merge-props.ts
type AnyProps = Record<string, unknown>

type PropsGetter = (previous: AnyProps) => object

type MergePropsInput = object | PropsGetter | null | undefined

type Handler = (...args: unknown[]) => unknown

type StyleCallback = (state: never) => unknown

const EMPTY_PROPS: AnyProps = {}

function isEventHandler(key: string, value: unknown) {
  const code0 = key.charCodeAt(0)
  const code1 = key.charCodeAt(1)
  const code2 = key.charCodeAt(2)
stylesheet/components/primitives/types.ts
import type * as React from "react"
import type {
  GestureResponderEvent,
  HostInstance,
  NativeSyntheticEvent,
  StyleProp,
  ViewStyle,
} from "react-native"

type Side = "top" | "bottom" | "left" | "right"
type Align = "start" | "center" | "end"
type Orientation = "horizontal" | "vertical"

type ComponentRenderFn<Props, State> = (
  props: Props,
  state: State
stylesheet/components/primitives/use-render.tsx
import * as React from "react"
import { useComposedRefs } from "./hooks"
import { mergeClassNames, mergeProps, mergeStyles } from "./merge-props"
import type { ClassNameProp, RenderProp, StyleValue } from "./types"

type AnyProps = Record<string, unknown>

type RefInput<T> = React.Ref<T> | undefined

interface UseRenderParameters<State, RefType = unknown, Props = AnyProps> {
  defaultComponent?: React.ElementType | undefined
  render?: RenderProp<Props, State> | undefined
  props?: object | readonly (object | null | undefined)[] | undefined
  state?: State | undefined
  ref?: RefInput<RefType> | readonly RefInput<RefType>[] | undefined
  className?: ClassNameProp<State>
  1. Copy and paste the following code into components/ui/item.tsx:
stylesheet/components/ui/item.tsx
import * as React from "react"
import {
  Pressable,
  type PressableStateCallbackType,
  type StyleProp,
  StyleSheet,
  View,
  type ViewProps,
  type ViewStyle,
} from "react-native"
import type { RenderProp } from "@/components/primitives/types"
import { useRender } from "@/components/primitives/use-render"
import { IconSizeContext } from "@/components/ui/icon"
import { Text, TextStyleContext } from "@/components/ui/text"
import { fontSize, metrics, radius, useTheme } from "@/components/ui/theme"
  1. Update the import paths to match your project setup.
  1. Target iOS 17 or later.

  2. Add the Swift package to your app:

Package.swift
.package(url: "https://github.com/phosphor-icons/swift", from: "2.1.0")
  1. Copy the theme files every view uses:
swift/Theme/Theme.swift
import CoreText
import SwiftUI
import UIKit

struct RGBA: Sendable {
  let red: CGFloat
  let green: CGFloat
  let blue: CGFloat
  let alpha: CGFloat

  init(_ hex: UInt32, _ alpha: CGFloat = 1) {
    red = CGFloat((hex >> 16) & 0xFF) / 255
    green = CGFloat((hex >> 8) & 0xFF) / 255
    blue = CGFloat(hex & 0xFF) / 255
    self.alpha = alpha
  }
swift/Theme/Tokens.swift
import SwiftUI

public enum EsuissColor {
  public static let background = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x000000))
  public static let foreground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let card = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let cardForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let popover = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F))
  public static let popoverForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let primary = Color.adaptive(light: .init(0x0071E3), dark: .init(0x0A84FF))
  public static let primaryForeground = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0xFFFFFF))
  public static let secondary = Color.adaptive(light: .init(0x000000, 0.04), dark: .init(0xFFFFFF, 0.1))
  public static let secondaryForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7))
  public static let muted = Color.adaptive(light: .init(0xF5F5F7), dark: .init(0x161617))
  public static let mutedForeground = Color.adaptive(light: .init(0x6E6E73), dark: .init(0x86868B))
  public static let accent = Color.adaptive(light: .init(0x000000, 0.06), dark: .init(0xFFFFFF, 0.1))
  1. Copy the source and every file it uses:
swift/Components/Item.swift
import SwiftUI

public enum ItemVariant: CaseIterable, Sendable {
  case `default`, outline, muted
}

public enum ItemSize: CaseIterable, Sendable {
  case `default`, sm, xs

  var horizontalPadding: CGFloat {
    switch self {
    case .default: 16
    case .sm: 14
    case .xs: 12
    }
  }
swift/Components/Separator.swift
import SwiftUI

public struct Separator: View {
  let orientation: Axis

  public init(_ orientation: Axis = .horizontal) {
    self.orientation = orientation
  }

  public var body: some View {
    Rectangle()
      .fill(EsuissColor.border)
      .frame(width: orientation == .vertical ? 1 : nil, height: orientation == .horizontal ? 1 : nil)
      .frame(maxWidth: orientation == .horizontal ? .infinity : nil, maxHeight: orientation == .vertical ? .infinity : nil)
      .accessibilityHidden(true)
  }
  1. Add the files to your app target.
  1. Apply the Compose compiler plugin, enable Compose, set compileSdk to 37 or higher and minSdk to 24 or higher, and add the dependencies:
build.gradle.kts
plugins {
    id("org.jetbrains.kotlin.plugin.compose")
}

android {
    compileSdk = 37
    defaultConfig { minSdk = 24 }
    buildFeatures { compose = true }
}

dependencies {
    implementation(platform("androidx.compose:compose-bom:2026.09.00"))
    implementation("androidx.compose.foundation:foundation")
    implementation("androidx.compose.ui:ui")
    implementation("com.adamglin:phosphor-icon-android:1.0.0")
}
  1. Copy the theme files every view uses:
kotlin/theme/Theme.kt
package com.esuiss.ui.theme

import android.content.res.AssetManager
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.dropShadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.shadow.Shadow as DropShadow
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
kotlin/theme/Tokens.kt
package com.esuiss.ui.theme

import androidx.compose.runtime.Immutable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp

@Immutable
data class Colors(
    val background: Color,
    val foreground: Color,
    val card: Color,
    val cardForeground: Color,
    val popover: Color,
    val popoverForeground: Color,
    val primary: Color,
  1. Copy the source and every file it uses:
kotlin/components/Item.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
kotlin/components/Button.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.BasicText
kotlin/components/ButtonGroup.kt
package com.esuiss.ui.components

import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.Immutable
kotlin/components/Content.kt
package com.esuiss.ui.components

import androidx.compose.runtime.compositionLocalOf
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp

val LocalContentStyle = compositionLocalOf { TextStyle.Default }

val LocalContentColor = compositionLocalOf { Color.Unspecified }

val LocalIconSize = compositionLocalOf { 20.dp }
kotlin/components/Header.kt
package com.esuiss.ui.components

import androidx.compose.animation.core.animate
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.interaction.collectIsPressedAsState
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.BasicText
import androidx.compose.runtime.Composable
kotlin/components/Icon.kt
package com.esuiss.ui.components

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.takeOrElse
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.Dp
import com.esuiss.ui.theme.EsuissTheme

@Composable
fun Icon(
    imageVector: ImageVector,
  1. Update the com.esuiss.ui package names to match your project.

Usage

import { CaretRightIcon, ShieldCheckIcon } from "phosphor-react-native"
import { View } from "react-native"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Icon } from "@/components/ui/icon"
import { ItemGroup, ItemSeparator, Item, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions, ItemHeader, ItemFooter } from "@/components/ui/item"
import { Text } from "@/components/ui/text"
<View className="gap-4">
  <Item variant="outline">
    <ItemContent>
      <ItemTitle>Basic item</ItemTitle>
      <ItemDescription>
        A simple item with a title and a description.
      </ItemDescription>
    </ItemContent>
    <ItemActions>
      <Button variant="outline" size="sm">
        <Text>Action</Text>
      </Button>
    </ItemActions>
  </Item>
  <Item variant="muted" size="sm" onPress={() => undefined}>
    <ItemMedia variant="icon">
      <Icon as={ShieldCheckIcon} />
    </ItemMedia>
    <ItemContent>
      <ItemTitle>Your profile has been verified.</ItemTitle>
    </ItemContent>
    <ItemActions>
      <Icon as={CaretRightIcon} className="size-4 text-muted-foreground" />
    </ItemActions>
  </Item>
  <Item variant="outline" size="xs">
    <ItemHeader>
      <ItemTitle>Header</ItemTitle>
      <Badge>
        <Text>New</Text>
      </Badge>
    </ItemHeader>
    <ItemContent>
      <ItemDescription>
        Items can carry a header and a footer.
      </ItemDescription>
    </ItemContent>
    <ItemFooter>
      <Text className="text-sm text-muted-foreground">Footer</Text>
    </ItemFooter>
  </Item>
</View>

This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.

import PhosphorSwift
import SwiftUI

struct ItemExample: View {
  var body: some View {
    VStack(alignment: .leading, spacing: 16) {
      Item(.outline) {
        ItemContent {
          ItemTitle("Basic item")
          ItemDescription("A simple item with a title and a description.")
        }
        ItemActions {
          Button("Action") {}
            .buttonStyle(.variant(.outline, size: .sm))
        }
      }
      Item(.muted, size: .sm, action: {}) {
        ItemMedia(.icon) {
          Ph.shieldCheck.regular
        }
        ItemContent {
          ItemTitle("Your profile has been verified.")
        }
        ItemActions {
          ItemChevron()
        }
      }
      Item(.outline, size: .xs) {
        ItemHeader {
          ItemTitle("Header")
          Badge("New")
        }
        ItemContent {
          ItemDescription("Items can carry a header and a footer.")
        }
        ItemFooter {
          Text("Footer")
            .textStyle(.sm)
            .foregroundStyle(EsuissColor.mutedForeground)
        }
      }
    }
  }
}

struct ItemChevron: View {
  var body: some View {
    Ph.caretRight.regular
      .frame(width: 16, height: 16)
      .foregroundStyle(EsuissColor.mutedForeground)
  }
}
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.adamglin.PhosphorIcons
import com.adamglin.phosphoricons.Regular
import com.adamglin.phosphoricons.regular.CaretRight
import com.adamglin.phosphoricons.regular.ShieldCheck
import com.esuiss.ui.components.Badge
import com.esuiss.ui.components.Button
import com.esuiss.ui.components.ButtonSize
import com.esuiss.ui.components.ButtonVariant
import com.esuiss.ui.components.Icon
import com.esuiss.ui.components.Item
import com.esuiss.ui.components.ItemActions
import com.esuiss.ui.components.ItemContent
import com.esuiss.ui.components.ItemDescription
import com.esuiss.ui.components.ItemFooter
import com.esuiss.ui.components.ItemHeader
import com.esuiss.ui.components.ItemMedia
import com.esuiss.ui.components.ItemMediaVariant
import com.esuiss.ui.components.ItemSize
import com.esuiss.ui.components.ItemTitle
import com.esuiss.ui.components.ItemVariant
import com.esuiss.ui.components.Text
import com.esuiss.ui.theme.EsuissTheme
import com.esuiss.ui.theme.Typography

@Composable
fun ItemCaret() {
    Icon(PhosphorIcons.Regular.CaretRight, contentDescription = null, size = 16.dp, tint = EsuissTheme.colors.mutedForeground)
}

@Composable
fun ItemDefault() {
    Column(Modifier.fillMaxWidth(), verticalArrangement = Arrangement.spacedBy(16.dp)) {
        Item(variant = ItemVariant.Outline, role = null) {
            ItemContent {
                ItemTitle("Basic item")
                ItemDescription("A simple item with a title and a description.")
            }
            ItemActions {
                Button("Action", onClick = {}, variant = ButtonVariant.Outline, size = ButtonSize.Sm)
            }
        }
        Item(variant = ItemVariant.Muted, size = ItemSize.Sm, onClick = {}) {
            ItemMedia(variant = ItemMediaVariant.Icon) {
                Icon(PhosphorIcons.Regular.ShieldCheck, contentDescription = null)
            }
            ItemContent {
                ItemTitle("Your profile has been verified.")
            }
            ItemActions { ItemCaret() }
        }
        Item(variant = ItemVariant.Outline, size = ItemSize.Xs, role = null) {
            ItemHeader {
                ItemTitle("Header")
                Badge("New")
            }
            ItemContent {
                ItemDescription("Items can carry a header and a footer.")
            }
            ItemFooter {
                Text("Footer", style = Typography.sm.copy(color = EsuissTheme.colors.mutedForeground))
            }
        }
    }
}

Examples

Inset group

Pressable rows in an inset group, with colored icon tiles, separators and trailing chevrons.

React Native
Item inset group in React Native, light modeItem inset group in React Native, dark mode
import { BellIcon, CaretRightIcon, WifiHighIcon } from "phosphor-react-native"
import { Icon } from "@/components/ui/icon"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemSeparator,
  ItemTitle,
} from "@/components/ui/item"
import { Text } from "@/components/ui/text"

export default function ItemInsetGroup() {
  return (
import { BellIcon, CaretRightIcon, WifiHighIcon } from "phosphor-react-native"
import { Icon } from "@/components/ui/icon"
import {
  Item,
  ItemActions,
  ItemContent,
  ItemDescription,
  ItemGroup,
  ItemMedia,
  ItemSeparator,
  ItemTitle,
} from "@/components/ui/item"
import { Text } from "@/components/ui/text"
import { palette, useTheme } from "@/components/ui/theme"

export default function ItemInsetGroup() {
import PhosphorSwift
import SwiftUI

struct ItemInsetGroupExample: View {
  var body: some View {
    ItemGroup(.inset) {
      Item(action: {}) {
        ItemMedia(.image) {
          ItemTile(icon: Ph.wifiHigh.regular, color: EsuissColor.primary)
        }
        ItemContent {
          ItemTitle("Wi-Fi")
        }
        ItemActions {
          Text("Home")
          ItemChevron()
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
import com.adamglin.PhosphorIcons
import com.adamglin.phosphoricons.Regular
import com.adamglin.phosphoricons.regular.Bell
import com.adamglin.phosphoricons.regular.CaretRight
import com.adamglin.phosphoricons.regular.WifiHigh
import com.esuiss.ui.components.Icon
import com.esuiss.ui.components.Item
import com.esuiss.ui.components.ItemActions
import com.esuiss.ui.components.ItemContent

Accessibility

  • ItemGroup has the list role.
  • A static Item has the listitem role; an item with onPress or onLongPress has the button role and fades to 80% opacity while pressed.
  • disabled dims the item and blocks presses.
  • ItemSeparator is hidden from VoiceOver and TalkBack.

API Reference

ItemGroup

List container for items.

PropTypeDefault
variant"default" | "inset""default"

Also accepts the props of ViewProps.

default stacks items with a gap; inset joins them into one rounded card.

ItemSeparator

Divider between items, inset inside an inset group.

Also accepts the props of ViewProps.

Item

The row itself, pressable when given a press handler.

PropTypeDefault
variant"default" | "outline" | "muted""default"
size"default" | "sm" | "xs""default"
renderRenderProp-

Also accepts the props of PressableProps.

size sets the padding and gap. Pass render to render the row as another component, such as a Pressable, while keeping the item styles.

ItemMedia

Leading icon, image or avatar.

PropTypeDefault
variant"default" | "icon" | "image""default"

Also accepts the props of ViewProps.

icon sizes icons to 16 points, and image makes a square thumbnail that shrinks with the item size.

ItemContent

Flexible column for the title and description.

Also accepts the props of ViewProps.

ItemTitle

Single-line title.

Also accepts the props of React.ComponentProps<typeof Text>.

ItemTitle truncates to one line and ItemDescription to two by default; override with numberOfLines.

ItemDescription

Secondary text, up to two lines.

Also accepts the props of React.ComponentProps<typeof Text>.

ItemActions

Trailing row for values, buttons or chevrons.

Also accepts the props of ViewProps.

Text inside it picks up text-muted-foreground.

ItemHeader

Full-width row above the content.

Also accepts the props of ViewProps.

ItemFooter

Full-width row below the content.

Also accepts the props of ViewProps.

ItemVariant

Values: .default, .outline, .muted.

ItemSize

Values: .default, .sm, .xs.

ItemGroupVariant

Values: .default, .inset.

ItemGroup

List container for items.

ParameterTypeDefault
_ variantItemGroupVariant: .default | .inset.default
content() -> Content-

ItemSeparator

Divider between items, inset inside an inset group.

Takes no parameters.

Item

The row itself, pressable when given a press handler.

ParameterTypeDefault
_ variantItemVariant: .default | .outline | .muted.default
sizeItemSize: .default | .sm | .xs.default
action(() -> Void)?nil
content() -> Content-

ItemMediaVariant

Values: .default, .icon, .image.

ItemMedia

Leading icon, image or avatar.

ParameterTypeDefault
_ variantItemMediaVariant: .default | .icon | .image.default
content() -> Content-

ItemContent

Flexible column for the title and description.

ParameterTypeDefault
content() -> Content-

ItemTitle

Single-line title.

ParameterTypeDefault
content() -> Content-
_ titleLocalizedStringKey-
verbatimString-

Overloads: init(content:), init(_:), init(verbatim:).

ItemDescription

Secondary text, up to two lines.

ParameterTypeDefault
_ descriptionLocalizedStringKey-
verbatimString-

Overloads: init(_:), init(verbatim:).

ItemActions

Trailing row for values, buttons or chevrons.

ParameterTypeDefault
content() -> Content-

ItemHeader

Full-width row above the content.

ParameterTypeDefault
content() -> Content-

ItemFooter

Full-width row below the content.

ParameterTypeDefault
content() -> Content-

ItemVariant

Values: Default, Outline, Muted.

ItemSize

Values: Default, Sm, Xs.

ItemGroupVariant

Values: Default, Inset.

ItemMediaVariant

Values: Default, Icon, Image.

ItemGroup

List container for items.

ParameterTypeDefault
modifierModifierModifier
variantItemGroupVariant: Default | InsetItemGroupVariant.Default
content@Composable ColumnScope.() -> Unit-

ItemSeparator

Divider between items, inset inside an inset group.

ParameterTypeDefault
modifierModifierModifier

Item

The row itself, pressable when given a press handler.

ParameterTypeDefault
modifierModifierModifier
variantItemVariant: Default | Outline | MutedItemVariant.Default
sizeItemSize: Default | Sm | XsItemSize.Default
onClick(() -> Unit)?null
onLongClick(() -> Unit)?null
enabledBooleantrue
selectedBoolean?null
roleRole?Role.Button
onClickLabelString?null
content@Composable () -> Unit-

ItemMedia

Leading icon, image or avatar.

ParameterTypeDefault
modifierModifierModifier
variantItemMediaVariant: Default | Icon | ImageItemMediaVariant.Default
content@Composable BoxScope.() -> Unit-

ItemContent

Flexible column for the title and description.

ParameterTypeDefault
modifierModifierModifier
content@Composable ColumnScope.() -> Unit-

ItemTitle

Single-line title.

ParameterTypeDefault
modifierModifierModifier
content@Composable RowScope.() -> Unit-
textString-

Overloads: ItemTitle(content), ItemTitle(text).

ItemDescription

Secondary text, up to two lines.

ParameterTypeDefault
textString-
modifierModifierModifier

ItemActions

Trailing row for values, buttons or chevrons.

ParameterTypeDefault
modifierModifierModifier
content@Composable RowScope.() -> Unit-

ItemHeader

Full-width row above the content.

ParameterTypeDefault
modifierModifierModifier
content@Composable RowScope.() -> Unit-

ItemFooter

Full-width row below the content.

ParameterTypeDefault
modifierModifierModifier
content@Composable RowScope.() -> Unit-
NextKbdPreviousInput OTP

On this page

  1. 01Installation
  2. 02Usage
  3. 03Composition
  4. 04Examples
    • Variants
    • Sizes
    • As link
    • With image
    • Inset
    • With avatar
    • With header and footer
  5. 05Accessibility
  6. 06API Reference
    • ItemGroup
    • ItemSeparator
    • Item
    • ItemMedia
    • ItemContent
    • ItemTitle
    • ItemDescription
    • ItemActions
    • ItemHeader
    • ItemFooter
  7. 07Installation
  8. 08Usage
  9. 09Examples
    • Inset group
  10. 10Accessibility
  11. 11API Reference
    • ItemGroup
    • ItemSeparator
    • Item
    • ItemMedia
    • ItemContent
    • ItemTitle
    • ItemDescription
    • ItemActions
    • ItemHeader
    • ItemFooter
    • ItemVariant
    • ItemSize
    • ItemGroupVariant
    • ItemGroup
    • ItemSeparator
    • Item
    • ItemMediaVariant
    • ItemMedia
    • ItemContent
    • ItemTitle
    • ItemDescription
    • ItemActions
    • ItemHeader
    • ItemFooter
    • ItemVariant
    • ItemSize
    • ItemGroupVariant
    • ItemMediaVariant
    • ItemGroup
    • ItemSeparator
    • Item
    • ItemMedia
    • ItemContent
    • ItemTitle
    • ItemDescription
    • ItemActions
    • ItemHeader
    • ItemFooter