Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / More

Section

A full-width band of a page: a background, space above and below, and the content in the page column. Stack Sections to build a landing or documentation page that scrolls as a document.

Landing page bands

When to useLink to "When to use"

  • The parts of a landing page: hero, features, pricing, a call to action, each its own band.
  • Alternating backgrounds on a long documentation page, to group related content.

Use something else when:

  • you only need the page column, with no background or vertical rhythm: Container
  • you want a bordered box inside the column: Card
  • you are building an app frame with a side navigation: AppShell

UsageLink to "Usage"

tsx
Copy
import { Heading, Section, SiteFooter, SiteHeader } from "@arshad-shah/cynosure";

<SiteHeader brand="Acme" nav={nav} />
<main id="main">
  <Section as="header">…hero…</Section>
  <Section variant="soft" id="features" aria-labelledby="features-heading">
    <Heading id="features-heading">Features</Heading>
  </Section>
  <Section variant="accent" size="md">…</Section>
</main>
<SiteFooter columns={columns} />

Width and full bleedLink to "Width and full bleed"

A Section fills its parent's width. For bands from edge to edge of the window, place Sections at the top level of the page (or directly in main), not inside a Container: each brings its own Container for the content. size sets that column's width; contained={false} drops it.

Content in the page column

PaddingLink to "Padding"

paddingBlock takes a space token. The default is the --cy-section-padding-block token, twice space 10.

Padding uses space tokens

PropsLink to "Props"

Every prop of Section
PropWhat it doesTypeDefault
variant
The band's background: plain (none, the page shows through), surface, soft (a quiet tint) or accent (a soft tint of the accent colour). Text colours stay readable on each. Default "plain"."plain" | "accent" | "soft" | "surface""plain"
paddingBlock
Space token for the padding above and below the content. Default: the --cy-section-padding-block token.Spacethe `--cy-section-padding-block` token
contained
Put the content in a centred Container (the page column). false lets it fill the band. Default true.booleantrue
size
Widest the inner Container gets (its size). Ignored when contained is false. Default "lg"."sm" | "md" | "lg" | "full" | "xl""lg"
as
The element rendered. A section is a region landmark only when it has a name (aria-labelledby or aria-label). Default "section"."div" | "section" | "article" | "aside" | "header" | "footer""section"
id
Set on the root element: the target of in-page links such as #pricing.string
aria-labelledby
Names the section, usually the id of its heading.string
aria-label
Names the section when it has no visible heading.string
role
An ARIA role for the root, when the element's own role is not the right one.AriaRole
className
Added to the root element, for layout.string
style
Layout only. Restyle through --cy-section-* tokens.CSSProperties
children
The section's content.ReactNode
data-testid
Set on the root element, for tests.string

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

Behaviour and accessibilityLink to "Behaviour and accessibility"

Section has no keyboard behaviour of its own.

  • Landmarks: a section is a region landmark only when it has a name: pass aria-labelledby with the id of its heading. as="aside" is a complementary landmark. role, aria-label and id are set on the root.
  • In-page links: id makes the Section the target of a link such as #pricing.
  • Colours: text keeps the ink colour on every variant. In forced-colours mode, bands with a background get a line above and below instead.
  • Nesting: a nested Section gets its own default padding.

TouchLink to "Touch"

Nothing pressable of its own; what you put in keeps its own hit areas.

ThemingLink to "Theming"

Theming, table 1
TokenWhat it setsDefault
--cy-section-padding-blockPadding above and below when paddingBlock is not setcalc(var(--cy-space-10) * 2)
--cy-section-surfaceBackground of variant="surface"--cy-color-surface
--cy-section-softBackground of variant="soft"--cy-color-soft
--cy-section-accentBackground of variant="accent"--cy-color-accent-soft
ts
Copy
createTheme({ components: { section: { paddingBlock: "6rem" } } });

Container · SiteHeader · SiteFooter · PageHeader · Card

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog