Every component in Compose Svelted accepts aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/compose_svelted/llms.txt
Use this file to discover all available pages before exploring further.
modifier prop. Rather than scattering inline styles or class names across your markup, you describe what you want — padding, clipping, scrollability, click handling — through a fluent, immutable chain of calls. Modifiers do not produce CSS directly at the call site; they accumulate declarative intent that the component runtime resolves into styles and classes when it renders.
The Modifier object
Modifier is a plain TypeScript object that exposes every modifier factory as a static method. Each call returns a new ModifierImpl instance — nothing is mutated. You can store modifiers in variables, compose them with .then(), or pass them directly as props.
The PaddingValue type
The padding() method accepts either a plain number (uniform padding on all four sides) or an object that specifies individual sides. All values default to 0 when omitted.
Method reference
Every method is available both on the staticModifier entry-point and on the ModifierImpl instance it returns, so chains of any length work naturally.
Padding and spacing
Applies uniform padding when passed a number, or per-side padding when passed
an object with optional
top, bottom, start, and end keys. The unit
parameter (default "px") is only used when valueOrParams is a number or
when the individual side values are numbers.Applies equal padding to the left and right sides. Unit is always
px.Applies equal padding to the top and bottom sides. Unit is always
px.Adds a top margin. Useful for creating vertical spacing between siblings
without wrapping them in a layout container.
Sizing
Expands the element to fill its container’s full width (
width: 100%; align-self: stretch).Expands the element to fill its container’s full height (
height: 100%; align-self: stretch).Combines
fillMaxWidth and fillMaxHeight: the element fills both axes of
its container.Sets an explicit width. Pass a number for pixel values, or a pre-formed CSS
string such as
"50%" or "auto".Sets an explicit height. Accepts the same forms as
width().Sets both width and height to the same value — shorthand for a square or
circle.
Participates in flex growth. The
weight value maps directly to flex-grow.
When fill is true (the default), flex-shrink is 1, allowing the
element to also shrink; when false, it only grows. Values of 0 or below
are silently ignored.Convenience alias for
weight(weight, false). The element grows at the given
ratio but will not shrink below its intrinsic size.Appearance
Sets the background colour. Accepts a raw CSS colour string or a
ColorToken key (e.g. ColorScheme.Primary), which is automatically
resolved to the corresponding CSS custom property at render time.Draws a solid border. Optionally accepts a
Shape (e.g.
RoundedCornerShape) to apply matching border-radius. Widths of 0 or
below are silently ignored.Clips the element to the given shape by applying
border-radius and
overflow: hidden. Use RoundedCornerShape to create the shape.Position and transform
Translates the element by
(x, y) pixels using a CSS transform: translate(). Does not affect layout flow — other elements remain in their
computed positions.Overrides the cross-axis alignment of a single child within its parent
container. The alignment token type must be compatible with the parent:
HorizontalAlignment inside a Column, VerticalAlignment inside a
Row, and BoxAlignment inside a Box.Scroll
Makes the element scrollable along the vertical axis (
overflow-y: auto).
Passing false is a no-op and returns the modifier unchanged.Makes the element scrollable along the horizontal axis (
overflow-x: auto).
Passing false is a no-op and returns the modifier unchanged.Interaction
Marks the element as interactive by adding the
compose-clickable CSS class
and the styles cursor: pointer; user-select: none. Pass an onClick
handler to react to clicks.Chaining modifiers
Merges another
ModifierImpl onto the end of the current one, producing a
new immutable instance. This is the primitive that all chained method calls
use internally. Use it directly when you want to combine two pre-built
modifier values.Passing modifiers to components
Every Compose Svelted layout and widget component accepts amodifier prop typed as Modifier (which is an alias for ModifierImpl). Pass your chain directly:
Internal methods: toStyle() and toClass()
ModifierImpl exposes two methods that are used internally by the component runtime — you will rarely need to call them yourself.
toStyle(): string— Concatenates all accumulated inline style strings from the modifier entries, then appends any alignment style derived from a.align()call. Returns a single CSS string ready to set on a DOM element’sstyleattribute.toClass(): string— Collects all CSS class names added by modifier entries (e.g."compose-clickable") and joins them into a space-separated string.