Elizabeth Mitchell a0efe1e78f docs: add doctype tags
PiperOrigin-RevId: 527386744
2023-04-26 15:10:19 -07:00

2.9 KiB

Divider

A divider is a thin line that groups content in lists and containers.

Dividers can reinforce tapability, such as when used to separate list items or define tappable regions in an accordion.

Screenshot of five stacked dividers

Usage

Use full width dividers to separate larger sections of unrelated content.

A full width divider separating two paragraphs of "Lorem ipsum"

<section>
  <p>Lorem ipsum...</p>
  <md-divider></md-divider>
  <p>Lorem ipsum...</p>
</section>

Inset dividers

Use inset dividers to separate related content within a section.

A list of design system names separated by an inset divider

<section>
  <p>Material 2</p>
  <md-divider inset></md-divider>
  <p>Material 3</p>
</section>

Inset dividers are equally indented from both sides of the screen by default. Use inset-start or inset-end to change this.

A list of design system names separated by a leading inset divider

<section>
  <p>Material 2</p>
  <md-divider inset-start></md-divider>
  <p>Material 3</p>
</section>

Accessibility

Add a role="separator" attribute to non-decorative dividers that separate sections of content or groups of menuitems.

<ul>
  <li>Item one</li>
  <md-divider role="separator"></md-divider>
  <li>Item two</li>
</ul>

Theming

Divider supports theming and can be customized with CSS custom property tokens.

Tokens

Token Default value
--md-divider-color --md-sys-color-outline-variant
--md-divider-thickness 1px

Example

A customized divider with a different color and thickness

<style>
:root {
  --md-sys-color-outline-variant: #BEC9C8;
  --md-divider-thickness: 2px;
}
</style>

<section>
  <p>Lorem ipsum...</p>
  <md-divider></md-divider>
  <p>Lorem ipsum...</p>
</section>