function · packages/mixins-ui/src/switch/view.ts:111
function configure < const Names extends string = never >(
config: Presets < SwitchPreset , Names >,
) : {
readonly view : < Outer > (
options: SwitchView < Outer > & PresetOption < Names >,
h: HtmlBuilder < Outer >,
) => Html
} The application's own Switch: 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.
Switch.draggable# function · packages/mixins-ui/src/switch/draggable.ts:160
function draggable < Message >(
onToggle : ( isChecked: boolean ) => Message ,
) : Mixin < Message > Lets the thumb be dragged: past the middle of the track on release, the
switch turns to the side it is on, sent as onToggle's Message. The click
the browser sends after the drag is swallowed, so a drag sends that one
Message and never two. Not built in, as a Scene test must resolve every Mount with a
Message; pass it beside the style (mixins: [style.mixin, Switch.draggable(onToggle)]),
with the onToggle the view was given. A disabled or read-only switch
does not drag.
Switch.resolve# function · packages/mixins-ui/src/switch.ts:18
function resolve < Input , Message >(
attributes: SwitchAttributes < Message >,
mixins: MixinList < Message >,
context: ResolveContext < Input , Message >,
) : ResolvedSwitch < Message > Applies mixins to the switch's bundles.
Switch.ResolvedSwitch# type · packages/mixins-ui/src/switch.ts:11
type ResolvedSwitch < Message > = Resolved <
SwitchAttributes < Message >,
typeof SwitchSlots,
Message
> The switch's bundles with the attached Mixins applied.
Switch.SwitchPreset# type · packages/mixins-ui/src/switch/view.ts:102
type SwitchPreset = Pick < SwitchView < never >, 'position' | 'style' > & {
readonly mixins?: MixinList < never >
} What a Switch is given once: its look and each option that holds no
Message and nothing of one field.
Switch.SwitchSlots# const · packages/mixins-ui/src/switch/slots.ts:8
const SwitchSlots: Slots . Contract <{ readonly button: Slot . UnnamedSlot < Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]>, readonly [Event . EventToken < "click" > ], readonly [Attr . AttrToken < "role" >, Attr . AttrToken < "aria-checked" >, Attr . AttrToken < "aria-labelledby" >, Attr . AttrToken < "aria-disabled" >, Attr . AttrToken < "aria-invalid" >, Attr . AttrToken < "disabled" >, Attr . AttrToken < "value" > ], readonly Slot . RequirementName [], boolean >; readonly label: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly [Event . EventToken < "click" > ], readonly Slot . AttributeName [], readonly Slot . RequirementName [], boolean >; readonly description: 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 hiddenInput: Slot . UnnamedSlot < Capability . Capability < "Base" , readonly []>, readonly Slot . EventName [], readonly [Attr . AttrToken < "value" > ], readonly Slot . RequirementName [], boolean >; readonly root: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capability . Capability < "Interactive" , readonly [Capability . Capability < "Base" , readonly []> ]> ]>, readonly [], readonly [], readonly [], false >; readonly text: Slot . UnnamedSlot < Capability . Capability < "Container" , readonly [Capab …;Mirrors the checkbox contract: both the control and its label own click.
root, text, heading and aside lay out the row Switch.view draws.
Switch.SwitchView# interface · packages/mixins-ui/src/switch/view.ts:17
interface SwitchView < Outer > {
readonly id: string
readonly checked: boolean
readonly onToggle : ( checked: boolean ) => NoInfer < Outer >
readonly label: string
readonly description?: string | undefined
readonly position?: TogglePosition | undefined
readonly labelAside?: Html | undefined
readonly disabled?: boolean | undefined
readonly readOnly?: boolean | undefined
readonly invalid?: boolean | undefined
readonly name?: string | undefined
readonly value?: string | undefined
readonly style?: NamedStyle < typeof SwitchSlots> | undefined
readonly mixins?: MixinList < Outer > | undefined
} Show all 16 lines Switch.toView# function · packages/mixins-ui/src/switch.ts:25
function toView < Message >(
mixins: MixinList < Message >,
context: ResolveContext < unknown , Message >,
draw : ( resolved: ResolvedSwitch < Message >) => Html ,
) : ( attributes: SwitchAttributes < Message >) => Html The switch's toView: draw receives its bundles with mixins applied.
Switch.view# function · packages/mixins-ui/src/switch/view.ts:45
function view < Outer >( options: SwitchView < Outer >, h: HtmlBuilder < Outer >) : Html