SectionHeader
Раскладка верха раздела: заголовок с описанием, действия в конце ряда и линия снизу, а кнопки, поиск и меню кладёт потребитель.
Импорт
ts
import { SectionHeader, SectionHeaderContent, SectionHeaderHeading, SectionHeaderTitle, SectionHeaderDescription, SectionHeaderActions, SectionHeaderDivider } from '@prosper/ui'Анатомия
vue
<SectionHeader>
<SectionHeaderContent>
<SectionHeaderHeading>
<SectionHeaderTitle>…</SectionHeaderTitle>
<SectionHeaderDescription>…</SectionHeaderDescription>
</SectionHeaderHeading>
<SectionHeaderActions>…</SectionHeaderActions>
</SectionHeaderContent>
<SectionHeaderDivider />
</SectionHeader>Примеры
По умолчанию
Заголовок с описанием, две кнопки sm в SectionHeaderActions и линия под рядом.
vue
<script setup lang="ts">
import {
Button,
SectionHeader,
SectionHeaderActions,
SectionHeaderContent,
SectionHeaderDescription,
SectionHeaderDivider,
SectionHeaderHeading,
SectionHeaderTitle,
} from '@prosper/ui'
</script>
<template>
<SectionHeader style="inline-size: 100%">
<SectionHeaderContent>
<SectionHeaderHeading>
<SectionHeaderTitle as="h3">Участники команды</SectionHeaderTitle>
<SectionHeaderDescription>
Управляйте участниками и их правами доступа.
</SectionHeaderDescription>
</SectionHeaderHeading>
<SectionHeaderActions>
<Button variant="secondary" size="sm">Экспорт</Button>
<Button size="sm">Пригласить</Button>
</SectionHeaderActions>
</SectionHeaderContent>
<SectionHeaderDivider />
</SectionHeader>
</template>С поиском
Поиск InputGroup размера sm шириной до 280 px стоит в SectionHeaderContent после заголовочного блока.
vue
<script setup lang="ts">
import {
InputGroup,
InputGroupAddon,
InputGroupInput,
SectionHeader,
SectionHeaderContent,
SectionHeaderDescription,
SectionHeaderDivider,
SectionHeaderHeading,
SectionHeaderTitle,
} from '@prosper/ui'
import { SearchLg } from '@prosper/ui/icons'
</script>
<template>
<SectionHeader style="inline-size: 100%">
<SectionHeaderContent>
<SectionHeaderHeading>
<SectionHeaderTitle as="h3">Счета</SectionHeaderTitle>
<SectionHeaderDescription>
Счета клиентов за последние двенадцать месяцев.
</SectionHeaderDescription>
</SectionHeaderHeading>
<InputGroup size="sm" style="flex: 0 1 17.5rem">
<InputGroupAddon><SearchLg /></InputGroupAddon>
<InputGroupInput
type="search"
aria-label="Поиск по счетам"
placeholder="Поиск"
/>
</InputGroup>
</SectionHeaderContent>
<SectionHeaderDivider />
</SectionHeader>
</template>С группой кнопок и меню
ButtonGroup размера sm и IconButton с DropdownMenu стоят в SectionHeaderActions и на узком экране уходят под заголовок вместе.
vue
<script setup lang="ts">
import { ref } from 'vue'
import {
ButtonGroup,
ButtonGroupItem,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
IconButton,
SectionHeader,
SectionHeaderActions,
SectionHeaderContent,
SectionHeaderDescription,
SectionHeaderDivider,
SectionHeaderHeading,
SectionHeaderTitle,
} from '@prosper/ui'
import { DotsVertical } from '@prosper/ui/icons'
const periods = ['12 месяцев', '30 дней', '7 дней'] as const
const period = ref<(typeof periods)[number]>('12 месяцев')
</script>
<template>
<SectionHeader style="inline-size: 100%">
<SectionHeaderContent>
<SectionHeaderHeading>
<SectionHeaderTitle as="h3">Выручка</SectionHeaderTitle>
<SectionHeaderDescription>
Поступления по всем магазинам за выбранный период.
</SectionHeaderDescription>
</SectionHeaderHeading>
<SectionHeaderActions>
<ButtonGroup size="sm" aria-label="Период выручки">
<ButtonGroupItem
v-for="item in periods"
:key="item"
:current="period === item"
@click="period = item"
>
{{ item }}
</ButtonGroupItem>
</ButtonGroup>
<DropdownMenu>
<DropdownMenuTrigger as-child>
<IconButton variant="tertiary" size="md" aria-label="Меню выручки">
<DotsVertical />
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent>
<DropdownMenuItem>Скачать отчёт</DropdownMenuItem>
<DropdownMenuItem>Настроить период</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
</SectionHeaderActions>
</SectionHeaderContent>
<SectionHeaderDivider />
</SectionHeader>
</template>С вкладками
Tabs с variant="border" стоят в SectionHeader между рядом и линией.
vue
<script setup lang="ts">
import {
Button,
SectionHeader,
SectionHeaderActions,
SectionHeaderContent,
SectionHeaderDescription,
SectionHeaderDivider,
SectionHeaderHeading,
SectionHeaderTitle,
Tabs,
TabsContent,
TabsList,
TabsTrigger,
} from '@prosper/ui'
</script>
<template>
<Tabs default-value="profile" variant="border" style="inline-size: 100%">
<SectionHeader>
<SectionHeaderContent>
<SectionHeaderHeading>
<SectionHeaderTitle as="h3">Настройки</SectionHeaderTitle>
<SectionHeaderDescription>
Профиль, пароль и уведомления учётной записи.
</SectionHeaderDescription>
</SectionHeaderHeading>
<SectionHeaderActions>
<Button variant="secondary" size="sm">Отменить</Button>
<Button size="sm">Сохранить</Button>
</SectionHeaderActions>
</SectionHeaderContent>
<TabsList aria-label="Разделы настроек">
<TabsTrigger value="profile">Профиль</TabsTrigger>
<TabsTrigger value="password">Пароль</TabsTrigger>
<TabsTrigger value="notifications">Уведомления</TabsTrigger>
</TabsList>
<SectionHeaderDivider />
</SectionHeader>
<TabsContent value="profile">Данные профиля</TabsContent>
<TabsContent value="password">Смена пароля</TabsContent>
<TabsContent value="notifications">Уведомления учётной записи</TabsContent>
</Tabs>
</template>API
SectionHeader
Корень заголовка раздела: колонка без отступов, фона и рамки, в которой части идут сверху вниз с промежутком 20 px.
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | SectionHeaderContent, вкладки и SectionHeaderDivider. |
SectionHeaderContent
Ряд с заголовочным блоком в начале и действиями в конце; действия на узкой ширине переносятся под заголовок.
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | SectionHeaderHeading, SectionHeaderActions и поиск. |
SectionHeaderHeading
Заголовочный блок: заголовок и описание колонкой с промежутком 2 px; занимает всю свободную ширину ряда.
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | SectionHeaderTitle и SectionHeaderDescription. |
SectionHeaderTitle
Заголовок раздела: полужирный текст 16/24, длинные слова переносятся.
Props
| Имя | Тип | По умолчанию | Описание |
|---|---|---|---|
as | string | 'h2' | Элемент заголовка, по умолчанию h2. |
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | Текст заголовка. |
SectionHeaderDescription
Описание под заголовком: абзац 14/20 приглушённого цвета, длинные слова переносятся.
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | Текст описания. |
SectionHeaderActions
Ряд кнопок после заголовочного блока с промежутком 12 px, на очень узкой ширине кнопки переносятся внутри ряда.
Слоты
| Имя | Тип | Описание |
|---|---|---|
default | {} | Кнопки и другие элементы действий. |
SectionHeaderDivider
Тонкая линия на всю ширину корня, обычно последняя часть.
Пропсов, событий и слотов нет.
Доступность
- Корень и части не задают атрибут
role. - Заголовок по умолчанию
h2, аasменяет уровень под структуру страницы. - Линия декоративная и скрыта от вспомогательных технологий.