Skip to content
IzzyBlazor 0.1.0-alpha.17

Enter all results ↑ ↓ move Esc close

Collapsible

One "show more" section.

JavaScript off: what the HTML and CSS do on their own.

Usage

razor
<Collapsible Label="Advanced options">
    <TextField @bind-Value="Model!.BuildCommand" />
</Collapsible>

A native details element without an accordion's frame, so it opens and closes with JavaScript off too. Use it for one section most people can skip; for several, use an Accordion, and for a panel over the page, a Popover.

Show more

Use Label for the text beside the chevron, for advanced options or details most people can skip.

Preview

Deploys run on every push to main and take about two minutes.

Advanced options
Build command
npm run build
Output folder
dist
Node version
22

Code

ShowMore.razor
<Stack Gap="2" MaxWidth="32.Rem">
    <TextBlock>Deploys run on every push to main and take about two minutes.</TextBlock>
    <Collapsible Label="Advanced options">
        <DescriptionList Size="ControlSize.Sm">
            <DescriptionItem Term="Build command">npm run build</DescriptionItem>
            <DescriptionItem Term="Output folder">dist</DescriptionItem>
            <DescriptionItem Term="Node version">22</DescriptionItem>
        </DescriptionList>
    </Collapsible>
</Stack>

Your own trigger

Use Trigger for inline content of your own in place of the label and chevron.

Preview

Why is this free?

The core library is open source under the MIT license. Paid plans add hosting and support.

Code

CustomTrigger.razor
<Collapsible MaxWidth="32.Rem">
    <Trigger><Badge Status="Status.Info" StartIcon="Lucide.Info">Why is this free?</Badge></Trigger>
    <ChildContent>
        <TextBlock Size="TextSize.Sm" Color="Color.Muted" MarginTop="2">The core library is open source under the MIT license. Paid plans add hosting and support.</TextBlock>
    </ChildContent>
</Collapsible>

Open from the server or C#

Use Open to start it open, such as when a post left an error inside it, and @bind-Open on an interactive page to follow it or open it from C#.

razor
@* Open after a post that found a problem in the advanced options. *@
<Collapsible Label="Advanced options" Open="_advancedInvalid">…</Collapsible>

@* Interactive pages: follow it, or open it from C#. *@
<Collapsible Label="Details" @bind-Open="_detailsOpen">…</Collapsible>

The browser keeps it open or closed, not the server: on a static page a post or reload draws it as Open says.

Mode support

What works in each mode, Collapsible
FeatureOffStaticLive
Opens and closesYesYesYes
Open bound to C#NoNoYes

Off: JavaScript disabled. Static: a static SSR page with IzzyBlazor's script. Live: an interactive page (Server, WebAssembly or Auto).

Accessibility

  • The summary takes Enter and Space and is announced as expanded or collapsed by the browser, with JavaScript off too.
  • Label or Trigger is the trigger's name, and one is required; the chevron is hidden.
  • Trigger content is drawn inside the summary, so keep it to inline content, with no links or buttons.
  • The trigger isn't a heading; put a Heading before it if the section needs one.

Parameters

Collapsible parameters
PropTypeDefault
LabelThe trigger text, after a chevron.string?
TriggerCustom trigger content, in place of Label and the chevron.RenderFragment?
ChildContentThe hidden content.RenderFragment?
@bind-OpenWhether it is open.boolfalse
IdThe element id.string?

See also

  • Accordion: sections that open and close with no script.
  • Popover: non-modal content beside a trigger.