Mixins / foldkit-mixins-ui

ScrollArea

namespace · packages/mixins-ui/src/scrollArea.ts:1

export * as ScrollArea from './scrollArea.js'

In the guides

Members

ScrollArea.configure

function · packages/mixins-ui/src/scrollArea.ts:79

function configure<const Names extends string = never>(
  config: Presets<ScrollAreaPreset, Names>,
): {
  readonly view: <Message = never>(
    options: ScrollAreaView<Message> & PresetOption<Names>,
    h: HtmlBuilder<Message>,
  ) => Html
}

The application's own ScrollArea: base for every use, presets chosen at a use with preset, and the call over both. mixins concatenate in that order (ScrollArea.overlayBars goes in base); any other option given at the call replaces the preset's.

ScrollArea.overlayBars

const · packages/mixins-ui/src/scrollArea/overlayBars.ts:11

const overlayBars: readonly [Mixin<never>]

What draws the area's bars over its viewport (ScrollBars), in place of the browser's, on a pointer that can hover; pass it beside the style. Not a default: its Mount sends no Message, yet a Scene test of every page that drew one would have to resolve it.

ScrollArea.ScrollAreaPreset

type · packages/mixins-ui/src/scrollArea.ts:69

type ScrollAreaPreset = Pick<ScrollAreaView<never>, 'style'> & {
  readonly mixins?: MixinList<never>
}

What a ScrollArea is given once: its look, and the bars and height that make it scroll.

ScrollArea.ScrollAreaSlots

const · packages/mixins-ui/src/scrollArea/slots.ts:7

const ScrollAreaSlots: 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 viewport: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly [Attr.AttrToken<'role'>, Attr.AttrToken<'aria-label'>],
    readonly Slot.RequirementName[],
    boolean
  >
  readonly bar: 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 thumb: Slot.UnnamedSlot<
    Capability.Capability<
      'Container',
      readonly [
        Capability.Capability<
          'Interactive',
          readonly [Capability.Capability<'Base', readonly []>]
        >,
      ]
    >,
    readonly Slot.EventName[],
    readonly Slot.AttributeName[],
    readonly Slot.RequirementName[],
    boolean
  >
}>

The viewport scrolls; the root around it holds an overlay bar per axis, each with its thumb, which overlayBars drives.

ScrollArea.ScrollAreaView

interface · packages/mixins-ui/src/scrollArea.ts:23

interface ScrollAreaView<Message = never> {
  readonly content: Html
  readonly label?: string | undefined
  readonly style?: NamedStyle<typeof ScrollAreaSlots> | undefined
  readonly mixins?: MixinList<Message> | undefined
}

A scroll area in one call: what scrolls inside it, a style for its slots, and mixins beside the style (including the height that makes it scroll). No upstream component stands behind it.

ScrollArea.view

function · packages/mixins-ui/src/scrollArea.ts:39

function view<Message = never>(
  options: ScrollAreaView<Message>,
  h: HtmlBuilder<Message>,
): Html