import { Meta, Story, Primary, Controls, Canvas } from "@storybook/addon-docs"; import * as stories from "./section.stories"; ```ts import { SectionComponent, SectionHeaderComponent } from "@bitwarden/components"; ``` # Section Sections are simple containers that apply a responsive bottom margin and utilize the semantic `section` HTML element. ```html
Lots of amazing content!
``` To remove the bottom margin (for example, if the section is the last item on the page), you can pass the `disableMargin` input. ```html ``` ## Section Header Sections often contain a heading. Use `bit-section-header` inside of the `bit-section`. ```html

I'm a section header

Section content here!
``` ### Section Header Padding When placed inside of a section with a `bit-card` or `bit-item` as the immediate next sibling (or nested in the immediate next sibling), the section header will automatically apply bottom and x-axis padding to align the header with the border radius of the card/item. ```html

I'm a section header

I'm card content

``` If placed inside of a section without a `bit-card` or `bit-item`, or with a `bit-card`/`bit-item` that is not a descendant of the immediate next sibling, the padding is not applied. ### Section Header Content Slots `bit-section-header` contains the following slots to help position the content: | Slot | Description | | ------------ | ------------------------------- | | default | title text of the header | | `slot="end"` | placed at the end of the header | #### Default slot Anything passed to the default slot will display as part of the title. The title should be a `bitTypography` element, usually an `h2` styled as an `h6`. Title suffixes (typically an icon or icon button) can be added as well. A gap is automatically applied between the children of the default slot. #### End slot The `end` slot will typically be used for text or an icon button.