m3e/bottom_sheet

bottom_sheet provides Lustre support for the M3E Bottom Sheet component

Types

BottomSheet is a sheet used to show secondary content anchored to the bottom of the screen

Fields:

  • detent: The zero‑based index of the detent the sheet should open to.
  • detents: Detents (discrete height states) the sheet can snap to.
  • handle: Whether to display a drag handle and enable the top region of the sheet as a gesture surface for dragging between detents.
  • handle_label: The accessible label given to the drag handle.
  • hideable: Whether the bottom sheet can hide when it is swiped down.
  • hide_friction: The friction coefficient to hide the sheet, or set it to the next closest expanded detent.
  • id: The identifier of the bottom sheet.
  • modal: Whether the bottom sheet behaves as modal.
  • state: Whether the bottom sheet is open
pub opaque type BottomSheet

Config allows for a declarative configuration of the BottomSheet

pub type Config {
  Config(
    detent: Int,
    detents: List(Detent),
    handle: Handle,
    handle_label: String,
    hideable: Hideable,
    hide_friction: Float,
    id: String,
    modal: Modal,
    state: State,
  )
}

Constructors

  • Config(
      detent: Int,
      detents: List(Detent),
      handle: Handle,
      handle_label: String,
      hideable: Hideable,
      hide_friction: Float,
      id: String,
      modal: Modal,
      state: State,
    )

Detent define the vertical positions a bottom sheet can rest at. A sheet may have no detents, a single detent, or multiple detents. Detents control how the sheet resizes, how it responds to drag gestures, and how the handle button behaves

pub type Detent {
  Collapsed
  Fit
  Half
  Full
}

Constructors

  • Collapsed
  • Fit
  • Half
  • Full

Handle determines if the drag handle is shown

pub type Handle {
  ShowHandle
  NoHandle
}

Constructors

  • ShowHandle
  • NoHandle

Hideable determines if the sheet can be hidden by swiping

pub type Hideable {
  Hideable
  NotHideable
}

Constructors

  • Hideable
  • NotHideable

Modal determines if the sheet is modal

pub type Modal {
  Modal
  Standard
}

Constructors

  • Modal
  • Standard

Slot gives type-safe names to each of the defined HTML named slots

pub type Slot {
  Header
}

Constructors

  • Header

State determines if the sheet is open or closed

pub type State {
  Open
  Closed
}

Constructors

  • Open
  • Closed

Values

pub fn default_config() -> Config

default_config returns a default Config

pub const default_handle: Handle
pub const default_hide_friction: Float
pub const default_hideable: Hideable
pub const default_modal: Modal
pub const default_state: State
pub fn detent(b: BottomSheet, detent: Int) -> BottomSheet

detent sets the detent field of a BottomSheet

pub fn detents(
  b: BottomSheet,
  detents: List(Detent),
) -> BottomSheet

detents sets the detents field of a BottomSheet

pub fn from_config(c: Config) -> BottomSheet

from_config creates a BottomSheet from a Config

pub fn handle(b: BottomSheet, handle: Handle) -> BottomSheet

handle sets the handle field of a BottomSheet

pub fn handle_label(
  b: BottomSheet,
  handle_label: String,
) -> BottomSheet

handle_label sets the handle_label field of a BottomSheet

pub fn hide_friction(
  b: BottomSheet,
  hide_friction: Float,
) -> BottomSheet

hide_friction sets the hide_friction field of a BottomSheet

pub fn hideable(
  b: BottomSheet,
  hideable: Hideable,
) -> BottomSheet

hideable sets the hideable field of a BottomSheet

pub fn id(b: BottomSheet, id: String) -> BottomSheet

id sets the id field of a BottomSheet

pub fn modal(b: BottomSheet, modal: Modal) -> BottomSheet

modal sets the modal field of a BottomSheet

pub fn new() -> BottomSheet

new creates a new BottomSheet

pub fn render(
  b: BottomSheet,
  children: List(element.Element(msg)),
) -> element.Element(msg)

render creates a Lustre Element from a BottomSheet

pub fn render_config(
  c: Config,
  children: List(element.Element(msg)),
) -> element.Element(msg)

render_config creates a Lustre Element from a Config

pub fn slot(s: Slot) -> attribute.Attribute(msg)

slot creates a Lustre ‘slot’ Attribute(msg) for a Slot

pub fn state(b: BottomSheet, state: State) -> BottomSheet

state sets the state field of a BottomSheet

Search Document