Publishing sectionsCaseSection
Searchastronomic.dev# CaseSection
For one part of a case study, such as the brief or the results: a small label that stays in view beside the text, and a photo after it.
Static: no JavaScript.
## Usage
```astro
import CaseSection from "@astronomic/ui-pro/components/CaseSection.astro";
```
## Examples
### Label and text
From a 48rem section the label sits in a start column a quarter wide and stays in view under a sticky Navbar while the text scrolls past; below that it sits above the text. The lead is a large opening line; your text goes in the default slot (a Prose block reads well).
```astro
---
import Prose from "@astronomic-dev/ui/components/Prose.astro";
import CaseSection from "@astronomic/ui-pro/components/CaseSection.astro";
---
<!-- From a 48rem section the label sits in its own column and stays in view while the text scrolls past. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<CaseSection label="The brief" lead="Larkspur sold out every kiln firing by word of mouth. They wanted a shop that kept up without feeling like a store.">
<Prose>
<p>Two potters, one kiln and a waiting list in a notebook. Each firing makes about sixty pieces, and every one is a little different, so a usual product grid with sizes and stock counts did not fit.</p>
<p>We started with the firing calendar. Each firing became a small release with its own date, a short note from the studio and the pieces from that kiln load. Buyers join the list for the next one.</p>
<p>The site launched in six weeks, and the first release sold out in an afternoon.</p>
</Prose>
</CaseSection>
</div>
```
### With a photo
The media slot (a photo, a CaseGallery or a VideoMedia) runs the full width after the label and the text.
```astro
---
import Media from "@astronomic-dev/ui/components/Media.astro";
import Prose from "@astronomic-dev/ui/components/Prose.astro";
import CaseSection from "@astronomic/ui-pro/components/CaseSection.astro";
// Your own photo.
import shelves from "../../photos/studio-shelves.webp";
---
<!-- The media slot runs the full width after the label and the text. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<CaseSection label="The shop">
<Prose>
<p>Each release page shows the kiln load as it came out: shelves of plates and bowls, photographed in the studio on the day of the firing.</p>
</Prose>
<Media slot="media" src={shelves} alt="Plates and bowls on white shelves in the studio." ratio="21/9" />
</CaseSection>
</div>
```
## Props
### CaseSection
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | None | Required. The section's label, such as "The brief" or "Results": its heading, small and semibold. The section is named by it. |
| `headingTag` | `"h2" \| "h3" \| "h4"` | `"h2"` | The label's element. |
| `lead` | `string` | None | A large opening line before the text, in the lead role, full ink. |
| `labelClass` | `string` | None | Classes for the label (the heading), merged with cn(). |
| `labelTypeClass` | `string` | None | The label's type in place of the kit's (text-small font-semibold), not merged: your theme's own face, size and weight, such as a mono label class. It is added as given, so a size name cn() does not know is neither dropped nor fought by the kit's. The label keeps its color, wrap and sticky column. |
| `rowClass` | `string` | None | The row's layout from its 48rem container, in place of the kit's two columns, top alignment and column gap, not merged: such as @3xl/case-section:grid-cols-12 @3xl/case-section:items-start and your own column gap. Keep items-start, or the label cannot stick. The row stays a grid with gap-group; a gap-y-* of yours wins over it. |
| `bodyClass` | `string` | None | Classes for the box that holds the lead and the text. |
| `class` | `string` | None | More classes for the <section>, merged with cn(). The section is a named size container (case-section). |
| Slot | Description |
| --- | --- |
| `default` | Your text, such as a Prose block. |
| `media` | A photo, a CaseGallery or a VideoMedia, full width after the text. |
Any other attribute goes on the <section>.
## Accessibility
- A <section> named by its label, which is a real heading (h2 by default), so the case study's parts show in the heading list.
- The label sticks only where it has its own column; on a phone it sits above the text and scrolls with it.
- Under your own sticky header (no kit Navbar), set --ui-nav-offset on <html> to its height, so the label stops under it.
CaseSection
ProFor one part of a case study, such as the brief or the results: a small label that stays in view beside the text, and a photo after it.
- File
- CaseSection.astro
- Group
- Publishing sections
- Kind
- Static: no JavaScript
- Examples
- 2
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Label and text
From a 48rem section the label sits in a start column a quarter wide and stays in view under a sticky Navbar while the text scrolls past; below that it sits above the text. The lead is a large opening line; your text goes in the default slot (a Prose block reads well).
This preview did not load.
main.astro
examples/casesection/main.astro
---
import Prose from "@astronomic-dev/ui/components/Prose.astro";
import CaseSection from "@astronomic/ui-pro/components/CaseSection.astro";
---
<!-- From a 48rem section the label sits in its own column and stays in view while the text scrolls past. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<CaseSection label="The brief" lead="Larkspur sold out every kiln firing by word of mouth. They wanted a shop that kept up without feeling like a store.">
<Prose>
<p>Two potters, one kiln and a waiting list in a notebook. Each firing makes about sixty pieces, and every one is a little different, so a usual product grid with sizes and stock counts did not fit.</p>
<p>We started with the firing calendar. Each firing became a small release with its own date, a short note from the studio and the pieces from that kiln load. Buyers join the list for the next one.</p>
<p>The site launched in six weeks, and the first release sold out in an afternoon.</p>
</Prose>
</CaseSection>
</div>With a photo
The media slot (a photo, a CaseGallery or a VideoMedia) runs the full width after the label and the text.
This preview did not load.
with-media.astro
examples/casesection/with-media.astro
---
import Media from "@astronomic-dev/ui/components/Media.astro";
import Prose from "@astronomic-dev/ui/components/Prose.astro";
import CaseSection from "@astronomic/ui-pro/components/CaseSection.astro";
// Your own photo.
import shelves from "../../photos/studio-shelves.webp";
---
<!-- The media slot runs the full width after the label and the text. -->
<div class="mx-auto max-w-6xl px-6 py-10">
<CaseSection label="The shop">
<Prose>
<p>Each release page shows the kiln load as it came out: shelves of plates and bowls, photographed in the studio on the day of the firing.</p>
</Prose>
<Media slot="media" src={shelves} alt="Plates and bowls on white shelves in the studio." ratio="21/9" />
</CaseSection>
</div>Minimal · Light