Skip to content

The open alternative to Salesforce, designed for AI.

3.2 KB
Raw Blame
---
title: Section
description: Group content with a heading, supporting description, and optional action.
---

import { PageBanner } from "/snippets/page-banner.mdx"

import { StoryEmbed } from '/snippets/ui/StoryEmbed.mdx';
import SectionReference from '/snippets/ui/generated/components/layout/section.mdx';

## Overview

`Section.Root` groups related content. `Section.Header` combines [Heading](/ui/primitives/typography/heading) with a description and optional `actions` content. Descriptions are ordinary text associated with the heading, so they do not add levels to the document outline.

<StoryEmbed
  storyId="ui-components-section--display"
  title="Section example"
  height={150}
/>

## Usage

```tsx
import { Section } from 'twenty-ui/components/layout';
import { Text } from 'twenty-ui/primitives/typography';

export const WorkspaceSection = () => (
  <Section.Root>
    <Section.Header
      title="Workspace settings"
      description="Manage your workspace name and preferences."
    />
    <Text>Workspace preferences appear here.</Text>
  </Section.Root>
);
```

## Add a description and action

```tsx
import { Section } from 'twenty-ui/components/layout';
import { Button } from 'twenty-ui/primitives/input';
import { Text } from 'twenty-ui/primitives/typography';

export const WorkspaceSection = () => (
  <Section.Root>
    <Section.Header
      title="Workspace settings"
      description="Manage your workspace name and preferences."
      actions={<Button>Edit workspace</Button>}
    />
    <Text>Workspace preferences appear here.</Text>
  </Section.Root>
);
```

`Section.Root` defaults to a full-width `div` with left alignment and the primary text color. Use `align`, `color`, and `fullWidth` to adjust the content wrapper.

`Section.Header` can also be used by itself. Its `level`, `size`, and `color` configure the heading and default to `2`, `md`, and `primary`. The header has one spacing-4 margin after it. Use native `style` or `className` to adjust that spacing.

## Description overflow

String descriptions show up to five lines. Set `descriptionLineClamp` to a positive integer to choose another limit, or `false` to display the full description without an overflow tooltip. Hover reveals overflowing text. Descriptions do not add a tab stop by default; set `isDescriptionFocusable` to enable focus access to the tooltip. Escape dismisses the tooltip.

The heading accepts node content. Choose `level` for the document outline independently of visual `size` and `color`. Compose links and other rich content explicitly in a node description.

Pass a React node for richer supporting content. Rich descriptions render as supplied, without automatic truncation or tooltips.

## Composition

Both parts forward native attributes, refs, class names, styles, and `render` to their outer element. For example, `Section.Root render={<section aria-label="Workspace settings" />}` provides a named section, and `Section.Header render={<header />}` uses a header container.

When migrating, replace `adornment` with `actions`. Opt into description focus with `isDescriptionFocusable` when needed. `SectionRootProps` and `SectionHeaderProps` are exported from `twenty-ui/components/layout`.

## Props

<SectionReference />

<PageBanner illustration="layout" />