Skip to content

SusExpansionPanels

SusExpansionPanels

Accordion host — builds SusExpansionPanel children from Items (+ optional multi-open via Opened).

Package

SusKit · Molecules (commercial)

Open in Playground

SusKit · Molecules

Props

NameTypeDefault
AccordionProp<bool>truev-model
ModelProp<string>""v-model
DensityProp<string>"default"v-model

Slots

No slots.

Events

NameFieldPayload
ChangeOnChangestring

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-expansion-panels
  • sus-expansion-panels__body
  • sus-expansion-panels__host
  • sus-expansion-panels__panel
  • sus-expansion-panels--accordion

Usage

Items are set in code (List<ExpansionPanelItem>). Each item carries Title, Value, optional Body.

csharp
var panels = new SusExpansionPanels();
panels.Accordion.Value = true;
panels.Items.Value = new List<SusExpansionPanels.ExpansionPanelItem>
{
    new() { Title = "General", Value = "general", Body = "Audio / graphics basics." },
    new() { Title = "Controls", Value = "controls", Body = "Keybinds and sensitivity." },
    new() { Title = "Privacy", Value = "privacy", Body = "Online visibility." },
};
panels.Model.Value = "general";
panels.OnChange += value => { /* … */ };
xml
<template>
  <sus:SusExpansionPanels :Model="OpenPanel.Value"
                          :Accordion="Accordion.Value"
                          Density="default"
                          @change="OnChange" />
</template>

<script>
public Prop<string> OpenPanel = new("general");
public Prop<bool> Accordion = new(true);
void OnChange(string value) { OpenPanel.Value = value; }
// Populate Items in code.
</script>
PropRole
ItemsList<ExpansionPanelItem> — panels to build
ModelActive panel value (accordion)
OpenedMulti-open list when Accordion is false
AccordionOnly one panel open at a time
DensityPassed through to child panels

Notes

  • For a single collapsible section, use atom SusExpansionPanel directly.