SectionCard

SectionCard

HkSectionCard is the standard titled section: a heading with an optional hint line, above one card that carries the body, plus an optional footnote line under the card. It exists so a page made of several lists — settings categories, tab panels, dashboards — gets its heading-to-body rhythm and hint typography from one definition instead of every caller hand-rolling its own margins.

  • For a bare surface with no heading, use HkCard; if the card is the whole panel and the caption is a simple title, the card alone is enough.
  • For a rule between two blocks that need no heading, use HkDivider.
  • Where the page-level scaffold keeps populated rows on screen through a refresh, this section replaces its body whenever loading is true — see the state note below.

Import

tsx
1
import { HkSectionCard } from "@celestia-island/hikari";
rust
1
2
use hikari_components::*;          // SectionCard, SectionCardProps, SectionHeadingLevel
use hikari_components::prelude::*; // rsx!, VNode, Icon, MdiIcon

The Rust form is a plain function, SectionCard(SectionCardProps { … }). Every prop may be omitted inside rsx!; title is the one field without a #[default], and its own default is the empty string, so an omitted title renders an empty heading element rather than nothing.

Heading, hint and count

title is required. hint is the explanatory line under the heading — the "what this list is for" copy every section used to spell itself. level picks the heading element only (h2, h3 by default, or div when the caption should not join the document outline); the visual size is fixed by the header styles. count renders as a trailing badge beside the title. dense tightens the header spacing for dense panels.

The section owns the intra-section rhythm only (heading block, then card). The gap between sections belongs to the page: several siblings need the parent's own gap, because this component adds no outer margin by design — hence the flex column in the samples.

Deployments3

One row per release, newest first.

The last release went out twelve minutes ago.

Constraints

Dense headers suit panels that already sit inside a card.

Slots: icon, actions, description and footer

icon is a leading glyph and actions is a right-aligned cluster beside the title — in Vue both go through the header's slots, so v-slots is the form that types. The description slot is the header's fallback for a non-text hint and renders only when the hint prop is unset, exactly like the prop-first rule inside the header. The footer slot adds trailing notes under the card with the same rhythm, so those notes stop being a per-consumer margin.

In the Rust mirror the same four are Element slots; the header's icon size is the host's own, so build the glyph at the size the header uses (15 units) rather than expecting it to be injected.

Exports

Runs nightly at 02:00 UTC.

Two exports are queued.

States and body padding

The body has three states: error replaces it with an alert, loading replaces it with a centred spinner, and otherwise the default slot renders. error wins when both are set, and an empty string counts as no error — the state follows JavaScript truthiness. Both standing states ride a padded card (a state is content, not a table), while the normal body honours padded, which defaults to false because tables carry their own cell padding and should sit flush in the card.

loading replaces the body whenever it is true. That is a deliberate difference from the page-level scaffold, which only replaces an empty body and keeps populated rows on screen through a refresh: pass loading for a section's first load, not for every refetch, or the refresh blanks a list the user is reading.

Failed to load

Loading

Padded body

Prose needs its own inset; a table would sit flush instead.

API

Vue

Props

NameTypeDefaultRequired
titleString—✓
hintStringundefined—
icon[Object, Function] as PropType<Component>undefined—
level<code>String as PropType<"h2" | "h3" | "div"></code>"h3"—
countStringundefined—
denseBooleanfalse—
errorStringundefined—
loadingBooleanfalse—
paddedBooleanfalse—

Rust

Props — SectionCard

PropTypeDefaultDescription
titleString""Section heading (Vue: required; the Rust default is the empty title, which still renders the heading element).
hintOption<String>NoneExplanatory line under the heading — the standard place for the "what this list is for" copy.
iconOption<Element>NoneLeading glyph slot (Vue: a component HkSectionHeader mounts at size 15; see the header delta).
levelSectionHeadingLevelSectionHeadingLevel::H3Heading element: h2 / h3 (default) / div.
countOption<String>NoneTrailing count beside the title (e.g. "3").
denseboolfalseTighter header spacing for dense panels.
errorOption<String>NoneHard failure: replaces the body with an alert (empty string = no error, Vue truthiness).
loadingboolfalseIn-flight: replaces the body with a centred spinner — pass it for the FIRST load, not every refetch, or it blanks a table the user is reading (the documented difference from the scaffold).
paddedboolfalseBody padding for non-table content (tables stay flush).
actionsOption<Element>NoneRight-aligned cluster beside the title (Vue: the header's actions slot).
descriptionOption<Element>NoneDescription fallback when hint is unset (Vue: the header's description slot).
footerOption<Element>NoneTrailing notes under the card (placeholder grammars, "what this list feeds" details) with the same rhythm.
childrenElement(empty)The section body (Vue: the default slot).

Accessibility

  • The heading is a real h2 or h3 element wrapping the title text, so it joins the document outline; level is what keeps that outline sensible when sections nest inside a page that already has its own headings. level="div" renders a visual heading with no outline entry — use it only when the surrounding structure already names the group.
  • The section element is <section>, which is a generic region unless it has an accessible name; naming it means giving the heading the right level so it lands in the outline, not relying on the wrapper.
  • The description line is a <p> under the heading, not part of its name: a screen-reader user hears the heading and then the hint, in that order.
  • count is a plain span beside the title, so it is read as part of the heading text ("Deployments 3"); keep it short. Both error and loading replace the body rather than sitting on top of it, so nothing stale stays in the accessibility tree while the state holds.

Related components

  • HkCard — the bordered surface this section wraps, with its own padding and scroll options.
  • HkDivider — the bare rule, for separations that need no heading.
  • HkTable — the list that usually fills the flush, unpadded body.
  • HkAlert — the alert an error state renders.