com.alecdorrington.laminarcomponents

Members list

Type members

Classlikes

object Baseline

Where an element's text stands on its baseline. Fonts differ by platform and script, so the baseline is measured rather than assumed, as to draw a rule beneath each line of text.

Where an element's text stands on its baseline. Fonts differ by platform and script, so the baseline is measured rather than assumed, as to draw a rule beneath each line of text.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Baseline.type
final class Chime(key: String)

A short chime for something arriving, two soft notes made on the spot. A page may make sound only once someone has pressed a key or clicked on it, so it is silent until then (listen); it chimes at most once in a while, and for any one arrival, only in one of the reader's tabs.

A short chime for something arriving, two soft notes made on the spot. A page may make sound only once someone has pressed a key or clicked on it, so it is silent until then (listen); it chimes at most once in a while, and for any one arrival, only in one of the reader's tabs.

Value parameters

key

The key in local storage under which the reader's tabs agree which of them chimes.

Attributes

Supertypes
class Object
trait Matchable
class Any
object ColourPicker

A swatch opening a popover that chooses a colour from given swatches, by shade and hue, or by its #rrggbb code. The popover is position: fixed and placed again beside its swatch on every scroll, so that a scrolling list cannot clip it. A colour is chosen only once a gesture settles (a drag let go), never mid-drag, so that choosing may ask a question or save.

A swatch opening a popover that chooses a colour from given swatches, by shade and hue, or by its #rrggbb code. The popover is position: fixed and placed again beside its swatch on every scroll, so that a scrolling list cannot clip it. A colour is chosen only once a gesture settles (a drag let go), never mid-drag, so that choosing may ask a question or save.

Drawn as .lc-colour-picker, its swatch .lc-colour-swatch, and its popover .lc-colour-popover, holding the .lc-colour-presets (.lc-colour-preset), the .lc-colour-field of shades (its thumb .lc-colour-field-thumb), the .lc-colour-hue slider and the .lc-colour-code field.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object ConfirmDialog

The page's one confirmation dialog, drawn by a single host at the root so that no ancestor of the asking control can clip it. Cancelling is the default.

The page's one confirmation dialog, drawn by a single host at the root so that no ancestor of the asking control can clip it. Cancelling is the default.

Drawn as .lc-confirm-dialog over a .lc-confirm-backdrop, its question a .lc-confirm-subject over a .lc-confirm-consequence, and its buttons .lc-confirm-buttons in .lc-confirm-actions: .lc-confirm-cancel, and each answer .lc-confirm-answer, or .lc-confirm-danger if it destroys.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
object Css

Stylesheets written in Scala, with Laminar's own typed style props: rules for selectors, holding what an element's inline styles cannot, its states (:hover), its parts (::after), and styles for some media alone (@media), with keyframes and font faces besides.

Stylesheets written in Scala, with Laminar's own typed style props: rules for selectors, holding what an element's inline styles cannot, its states (:hover), its parts (::after), and styles for some media alone (@media), with keyframes and font faces besides.

A rule nested in another applies within it, its & standing for the outer rule's selector (else a descendant of it), as in CSS nesting, but each is written out whole, for any browser:

import com.raquo.laminar.api.L.*
import com.alecdorrington.laminarcomponents.Css.{media, rule}

val styles = Stylesheet(
 rule(".card")(
   padding.px(12),
   borderRadius.px(8),
   rule("&:hover")(backgroundColor := "#eef"),
   rule(".card-title")(fontWeight.bold),
   media("(max-width: 600px)")(padding.px(8)),
 ),
)

Import the builders by name, as Laminar has a media of its own.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Css.type
object CssProps

The style props Laminar lacks, among them the logical properties (which follow the text's direction), grid layout, and the font face descriptors (Css.fontFace), each set as Laminar's own are: insetInlineStart.px(0) will not do, as these take any value, so insetInlineStart := "0".

The style props Laminar lacks, among them the logical properties (which follow the text's direction), grid layout, and the font face descriptors (Css.fontFace), each set as Laminar's own are: insetInlineStart.px(0) will not do, as these take any value, so insetInlineStart := "0".

Import them by name or all at once (CssProps.*): if Laminar gains one, the two clash where it is used, and this one should go. Two are named apart from attributes Laminar has: translation and fontSource.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
CssProps.type
object Dropdown

A drop-down of options, each sent under its code, one of them chosen.

A drop-down of options, each sent under its code, one of them chosen.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Dropdown.type
object FieldText

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
FieldText.type
final class FieldText(put: Signal[String] = ...)

A field's text: whichever came last, the typing or a change of put, so that a field may be cleared or filled from outside without a Var.

A field's text: whichever came last, the typing or a change of put, so that a field may be cleared or filled from outside without a Var.

Value parameters

put

The text put in the field from outside, as when it is cleared once sent.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Glide

Slides the elements a change moves from where they were drawn into their new places, rather than letting them jump there: where each stood is read before the change and again once it is laid out, and each that moved is drawn from where it stood and slid home. Elements are matched by keys of the caller's, so that one drawn afresh slides as the one it replaced. A block slides by transform; an inline element, which takes none, by its offsets, so it must be position: relative. Nothing slides for a reader who would rather nothing moved of itself.

Slides the elements a change moves from where they were drawn into their new places, rather than letting them jump there: where each stood is read before the change and again once it is laid out, and each that moved is drawn from where it stood and slid home. Elements are matched by keys of the caller's, so that one drawn afresh slides as the one it replaced. A block slides by transform; an inline element, which takes none, by its offsets, so it must be position: relative. Nothing slides for a reader who would rather nothing moved of itself.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Glide.type
object Handover

Hands text shown for reading back to the field editing it the moment the reader types. The field takes the focus while the keystroke is still being handled, so that the keystroke itself lands in it.

Hands text shown for reading back to the field editing it the moment the reader types. The field takes the focus while the keystroke is still being handled, so that the keystroke itself lands in it.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Handover.type
final case class Hsv(hue: Double, saturation: Double, value: Double)

A colour by hue, saturation and value. Unlike a #rrggbb code, it keeps its hue while grey.

A colour by hue, saturation and value. Unlike a #rrggbb code, it keeps its hue while grey.

Value parameters

hue

The hue, in degrees, from 0 to 360.

saturation

The saturation, from 0 to 1.

value

The value, from 0 (black) to 1.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Hsv

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Hsv.type
object Menu

A drop-down menu, closed by a choice, a click elsewhere, or Escape. Its own clicks never reach the document, so opening one never closes it.

A drop-down menu, closed by a choice, a click elsewhere, or Escape. Its own clicks never reach the document, so opening one never closes it.

Drawn as .lc-menu, its button .lc-menu-toggle, the list .lc-menu-list and its choices .lc-menu-item.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Menu.type
object NumberInput

A number typed into a field, or stepped by the arrows forming its end, which repeat while held, in place of the browser's own, which differ from browser to browser. The arrows reach the field as typing would, by input and change.

A number typed into a field, or stepped by the arrows forming its end, which repeat while held, in place of the browser's own, which differ from browser to browser. The arrows reach the field as typing would, by input and change.

Drawn as .lc-number-input, the field within it, and its arrows .lc-number-steps in .lc-number-steps, each icon a .lc-number-arrow. The arrows' width is --lc-number-steps, which a width given the box should add to the number's room: calc(5em + var(--lc-number-steps)).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final class PageBadge(icon: String)

A count of what awaits the reader, shown beyond the page while it is not 0: before the page's title, in red on the tab's icon, and on an installed app's icon in the taskbar or dock.

A count of what awaits the reader, shown beyond the page while it is not 0: before the page's title, in red on the tab's icon, and on an installed app's icon in the taskbar or dock.

Value parameters

icon

The URL of the page's icon, which the count is drawn over.

Attributes

Supertypes
class Object
trait Matchable
class Any
final case class Reordering(rows: Vector[Extent], from: Int, offset: Double)

A row of a list being dragged into a new place, against the rows as they lay when the drag began, the rows it passes moving aside to make room.

A row of a list being dragged into a new place, against the rows as they lay when the drag began, the rows it passes moving aside to make room.

Value parameters

from

The dragged row's place.

offset

How far down it has been dragged, in pixels (up where negative).

rows

Each row's extent down the page, in order.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Reordering

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Reordering.type
object Requests

Requests made from event handlers, each followed only until it answers.

Requests made from event handlers, each followed only until it answers.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Requests.type
final class Router[R](parse: String => R, path: R => String)

The current route of a page, kept in step with the address bar and history. Change it only through navigate and redirect.

The current route of a page, kept in step with the address bar and history. Change it only through navigate and redirect.

Type parameters

R

A route.

Value parameters

parse

The route a URL path names.

path

The path of a route's URL.

Attributes

Supertypes
class Object
trait Matchable
class Any
object Streaming

Requests whose response is read line by line as it arrives.

Requests whose response is read line by line as it arrives.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Streaming.type
object Stylesheet

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Stylesheet.type
final class Stylesheet extends Modifier[Base]

A stylesheet written in Scala (Css), kept beside the view it styles and given to the view's element as a modifier: the first element given it adds it to the page's head, where it stays.

A stylesheet written in Scala (Css), kept beside the view it styles and given to the view's element as a modifier: the first element given it adds it to the page's head, where it stays.

Value parameters

blocks

Its rules, in order.

layer

The cascade layer its rules go in, if any. Rules in no layer outweigh those in any layer, whatever their selectors, so that a page restyles a layered component without matching its selectors.

Attributes

Companion
object
Supertypes
trait Modifier[Base]
class Object
trait Matchable
class Any
object Switch

An on/off setting: a checkbox, drawn as a slider (.lc-switch, its slider .lc-switch-track) with the switch role, or as a tick box (.lc-check).

An on/off setting: a checkbox, drawn as a slider (.lc-switch, its slider .lc-switch-track) with the switch role, or as a tick box (.lc-check).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Switch.type
object Tabs

Tabs over one pane at a time, each pane built when its tab is first opened and kept, so that a half-filled form survives a look at another tab. Which tab is open is a mode of the page, not where it is.

Tabs over one pane at a time, each pane built when its tab is first opened and kept, so that a half-filled form survives a look at another tab. Which tab is open is a mode of the page, not where it is.

Drawn as .lc-tabs, its tabs .lc-tab (.lc-tab-current while open) in a .lc-tab-strip, each name a .lc-tab-label.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Tabs.type
object TextCaret

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
TextCaret.type
class TextCaret(aside: String)

Offsets in the text of an element, read from points on the screen and from the page's selection, and where a caret at one stands: what a field drawn over rendered text, or a highlighter, needs to know where the reader is. The text of elements matching aside, such as notes drawn between the words, is no part of the element's own, so it is skipped, a point within it counting as where it stands.

Offsets in the text of an element, read from points on the screen and from the page's selection, and where a caret at one stands: what a field drawn over rendered text, or a highlighter, needs to know where the reader is. The text of elements matching aside, such as notes drawn between the words, is no part of the element's own, so it is skipped, a point within it counting as where it stands.

Value parameters

aside

The selector of the elements whose text is skipped.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object Theme

The custom properties the components are coloured and shaped by, each with a default. A page sets them to its own, usually on :root:

The custom properties the components are coloured and shaped by, each with a default. A page sets them to its own, usually on :root:

Stylesheet(rule(":root")(Theme.accent := "#0b7a75", Theme.radius := "4px"))

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Theme.type
object Toggle

Something that opens and closes, such as a menu or a popover, folded from every cause of either.

Something that opens and closes, such as a menu or a popover, folded from every cause of either.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Toggle.type
object Tooltip

The page's one tooltip, for every hint in place of title, which opens late and cannot be styled. A single host at the root draws it, so that no ancestor can clip it. It opens at once on hover, keyboard focus or a tap, beside the line of its element nearest the pointer, in the element's language.

The page's one tooltip, for every hint in place of title, which opens late and cannot be styled. A single host at the root draws it, so that no ancestor can clip it. It opens at once on hover, keyboard focus or a tap, beside the line of its element nearest the pointer, in the element's language.

Drawn as .lc-tooltip ([data-side='below'] when below its element), its content in a .lc-tooltip-body, a plain hint a .lc-tooltip-text.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Tooltip.type
object Visible

Whether an element is on the page, as a signal decides.

Whether an element is on the page, as a signal decides.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Visible.type
final class Writes

The writes this client makes to one part of the server's state, kept so that a read of that part never undoes an edit made here:

The writes this client makes to one part of the server's state, kept so that a read of that part never undoes an edit made here:

  • A read is used only if no write began while it was on its way, nor was on its way when it began. Otherwise it is read again once the writes are done (settled).
  • A value read replaces the one on screen only where that is what the server was last known to hold; otherwise it is an edit not yet sent.

Values are recorded against the thing they belong to, usually the Var holding them, compared by identity.

Attributes

Supertypes
class Object
trait Matchable
class Any