Accordion.AccordionItem# interface · packages/mixins-ui/src/accordion.ts:46
interface AccordionItem {
readonly id: string
readonly title: string
readonly icon?: Html | undefined
readonly trailing?: Html | undefined
readonly content: Html | string
readonly disabled?: boolean | undefined
} Accordion.AccordionPreset# type · packages/mixins-ui/src/accordion.ts:150
type AccordionPreset = Pick <
AccordionView < never >,
'icon' | 'headingLevel' | 'style'
> & {
readonly mixins?: MixinList < never >
} What an Accordion is given once: its look and the options that hold no Message.
Accordion.AccordionSlots# const · packages/mixins-ui/src/accordion.ts:20
const AccordionSlots: Slots . Contract <{ readonly root: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly item: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly heading: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly trigger: Slot . UnnamedSlot < Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]>, readonly [Event . EventToken < "click" > ], readonly [Attr . AttrToken < "aria-expanded" >, Attr . AttrToken < "aria-controls" >, Attr . AttrToken < "disabled" > ], readonly Slot . RequirementName [], boolean >; readonly leading: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly Slot . EventName [], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly label: Slot . UnnamedSlot < Capability . Capability < "Container" , rea …;An accordion: sections whose headings each show and hide their panel, as
the APG accordion pattern has it. Each trigger is a button in a heading,
with aria-expanded and aria-controls; each panel is a region named by
its trigger. Which sections are open is the application's, in its Model:
the view draws open and sends onToggle, and toggled is the
transition update applies. A shut panel stays drawn and is inert, out
of the accessibility tree and the tab order, so its close can animate and
aria-controls always names a node.
Accordion.AccordionView# interface · packages/mixins-ui/src/accordion.ts:59
interface AccordionView < Message > {
readonly items: ReadonlyArray < AccordionItem >
readonly open: ReadonlyArray < string >
readonly onToggle : ( id: string ) => NoInfer < Message >
readonly id: string
readonly icon?: Html | undefined
readonly headingLevel?: 2 | 3 | 4 | 5 | 6 | undefined
readonly style?: NamedStyle < typeof AccordionSlots> | undefined
readonly mixins?: MixinList < Message > | undefined
} Accordion.Args# const · packages/mixins-ui/src/accordion/state.ts:17
const Args: Schema . Struct <{
readonly open: Schema . optionalKey < Schema . $Array < Schema . String >>
readonly multiple: Schema . optionalKey < Schema . Boolean >
readonly collapsible: Schema . optionalKey < Schema . Boolean >
}> What decides how a press changes the open sections, the same for the life of a placement.
function · packages/mixins-ui/src/accordion.ts:159
function configure < const Names extends string = never >(
config: Presets < AccordionPreset , Names >,
) : {
readonly view : < Outer > (
options: AccordionView < Outer > & PresetOption < Names >,
h: HtmlBuilder < Outer >,
) => Html
} The application's own Accordion: base for every use, presets chosen at
a use with preset, and the call over both. mixins concatenate in that
order; any other option given at the call replaces the preset's.
Accordion.controls# function · packages/mixins-ui/src/accordion/state.ts:42
function controls < Outer >(
model: Model ,
onMessage : ( message: Message ) => Outer ,
) : { open: readonly string []; onToggle : ( id: string ) => Outer } The view's open and onToggle for a placed Model:
Accordion.view({ id, items, ...Accordion.controls(model, onMessage) }, h).
Accordion.init# function · packages/mixins-ui/src/accordion/state.ts:27
function init ( args?: Args ) : Model Accordion.Message# const · packages/mixins-ui/src/accordion/state.ts:10
const Message: MessageUnion <{
readonly Toggled: { readonly id: Schema . String }
}> Accordion.Model# const · packages/mixins-ui/src/accordion/state.ts:7
const Model: Schema . Struct <{ readonly open: Schema . $Array < Schema . String > }> The ids of the open sections, in the order they opened.
Accordion.toggled# function · packages/mixins-ui/src/accordion/toggled.ts:9
function toggled (
open: ReadonlyArray < string >,
id: string ,
options?: {
readonly multiple?: boolean | undefined
readonly collapsible?: boolean | undefined
},
) : ReadonlyArray < string > The open sections after id is pressed. With multiple, any number stay
open; otherwise opening one shuts the others. A pressed open section shuts
unless it is the only one open and collapsible is false (shadcn's and
Zag's default for a single accordion is collapsible, and so is this).
Accordion.update# function · packages/mixins-ui/src/accordion/state.ts:30
function update (
model: Model ,
message: Message ,
args?: Args ,
) : Return < Model , Message > The sections after message; the Model it was given when the press changes nothing.
Accordion.view# function · packages/mixins-ui/src/accordion.ts:80
function view < Message >(
options: AccordionView < Message >,
h: HtmlBuilder < Message >,
) : Html