Trigger host and state
A headless primitive: what it adds is the state, the ARIA wiring between trigger and content, and the height animation — the look is the trigger's. On a <div> the directive supplies what a button would have had: role="button", a tab stop and Enter/Space, so the second row is just as reachable as the first. disabled ignores presses and dims the trigger through --gog-collapsible-disabled-opacity; a programmatic [open] write still works.
<button>
Ships within 2 business days.
Ships within 2 business days.
Ships within 2 business days.
<div>
Closed
Ships within 2 business days.
Open
Ships within 2 business days.
Disabled
Ships within 2 business days.
<!-- gog-collapsible renders no box of its own (display: contents), so each cell is a <div>. -->
<div>
<span><button></span>
@for (state of states; track state.name) {
<div>
<gog-collapsible [open]="state.open" [disabled]="state.disabled">
<button type="button" gogButton variant="outline" gogCollapsibleTrigger>
{{ state.name }}
</button>
<p gogCollapsibleContent>Ships within 2 business days.</p>
</gog-collapsible>
</div>
}
</div>
<div>
<!-- The directive makes a <div> a control: role="button", tabindex="0", Enter and Space. -->
<span><div></span>
@for (state of states; track state.name) {
<div>
<gog-collapsible [open]="state.open" [disabled]="state.disabled">
<div gogCollapsibleTrigger>{{ state.name }}</div>
<p gogCollapsibleContent>Ships within 2 business days.</p>
</gog-collapsible>
</div>
}
</div>