Skip to main content

List Item

List Item is a row that presents related information or actions, such as a language setting, delivery address, or account link.

Import

import { ListItem } from '@vortexlabs/vortex-native';
import type { ListItemProps } from '@vortexlabs/vortex-native';

Other links

import { ListItem } from "@vortexlabs/vortex-native";

<ListItem
  description="Preferred language"
  value="English"
  size="md"
>
  Language
</ListItem>

Features

  • Shows a title, supporting text, a current value, and leading or trailing content.
  • Supports static, pressable, linked, and selected rows.
  • Groups related rows in a labeled box with dividers.

Set href to open a URL. Set chevron to show that the row leads somewhere.

<ListItem href="https://vortex.mobile" chevron>
  Vortex Native Storybook
</ListItem>

Sizes

Use sm for a more compact row. The standard md row leaves more room around its label and icons.

<ListItem.Group>
  <ListItem size="sm" description="Push notifications">Small</ListItem>
  <ListItem size="md" description="Push notifications">Medium</ListItem>
</ListItem.Group>

Icons

Use startIcon before the title or endIcon after the value.

import { Folder, Heart } from "@vortexlabs/vortex-icons";

<ListItem.Group>
  <ListItem startIcon={Folder}>Projects</ListItem>
  <ListItem endIcon={Heart}>Favorites</ListItem>
  <ListItem startIcon={Folder} endIcon={Heart}>Favorite projects</ListItem>
</ListItem.Group>

Custom Slots

Use startSlot for an avatar and endSlot for a badge. A leading icon replaces the leading slot.

<ListItem
  startSlot={<Avatar initials="AL" size="sm" rounded />}
  endSlot={<Badge tone="success">Active</Badge>}
  description="Trip organizer"
>
  Ada Lee
</ListItem>

States

Set selected to mark the current choice. Set disabled to prevent presses.

import { Check } from "@vortexlabs/vortex-icons";
import { ListItem } from "@vortexlabs/vortex-native";
import { useState } from "react";

export const ListItemSelectionExample = () => {
  const [selected, setSelected] = useState("Email");
  return (
    <ListItem.Group label="Notification method" dividers={false}>
      {["Email", "Push", "SMS"].map((method) => (
        <ListItem
          key={method}
          selected={selected === method}
          endIcon={selected === method ? Check : undefined}
          disabled={method === "SMS"}
          description={method === "SMS" ? "Add a phone number first" : undefined}
          attributes={{ role: "radio" }}
          onPress={() => setSelected(method)}
        >
          {method}
        </ListItem>
      ))}
    </ListItem.Group>
  );
};

Actions

Use onPress for a tap or onLongPress for a press and hold.

import { Check } from "@vortexlabs/vortex-icons";
import { ListItem } from "@vortexlabs/vortex-native";
import { useState } from "react";

export const SavePlace = () => {
  const [saved, setSaved] = useState(false);
  return (
    <ListItem onPress={() => setSaved(!saved)} endIcon={saved ? Check : undefined}>
      {saved ? "Remove from saved places" : "Save this place"}
    </ListItem>
  );
};

ListItem.Group

Use label and description for context that applies to every row. Set dividers={false} to hide separators.

<ListItem.Group label="Preferences" description="These settings apply to this device.">
  <ListItem value="English">Language</ListItem>
  <ListItem value="Sydney">Region</ListItem>
</ListItem.Group>

Custom Rendering

Use render to wrap the supplied pressable in an Expo Router link.

import { ListItem } from "@vortexlabs/vortex-native";
import { Link } from "expo-router";

<ListItem
  chevron
  attributes={{ role: "link" }}
  render={(element) => <Link href="/settings" asChild>{element}</Link>}
>
  Settings
</ListItem>

Accessibility

Description
Give each action or link a descriptive label in children.