Documentation 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.
Surface and Text are the two foundational building blocks of every Compose Svelted layout. Surface establishes a themed background region, while Text renders content with the typographic scale defined by Material 3. Both components are fully independent of Tailwind and rely on CSS custom properties set by ComposeTheme.
Surface
Surface maps directly to the Material 3 surface concept: a bounded area whose background color is driven by a ColorToken from the active theme. It renders as a block-level <div> and accepts a Modifier for sizing, padding, and any other layout constraints.
Props
A
Modifier instance that controls layout, size, padding, and other inline styles applied to the surface container.A
ColorToken key from ColorScheme. Resolves to the matching --md-sys-color-* CSS variable at runtime. Defaults to "surface", matching the M3 surface role.Slots
| Slot | Description |
|---|---|
default | Any content you want to place inside the surface container. |
ColorToken reference
ColorToken is a union of all keys defined in ColorScheme. The full set of available tokens is:
color="primary") or use the ColorScheme constants for type safety.
Basic example
Nested surfaces with distinct color roles
Material 3 encourages layering surfaces with complementary roles. UseColorScheme constants to reference semantic tokens:
Surface does not apply any border-radius by default. Use a Card component when you need rounded corners and elevation — Card is built on top of Surface and adds those styles automatically.Text
Text renders a Material 3 paragraph element (<p>) styled by the theme’s typographic scale. Every visual property — font size, weight, line-height, letter-spacing — is resolved from a TextStyleToken through CSS custom properties, so it automatically adapts when the active theme changes.
Props
A
Modifier instance for layout, sizing, and additional inline styles on the text element.Selects the typographic style to apply. Must be one of the
TextStyleToken values listed below.Sets the text color. Accepts a
ColorToken (resolved against the active theme) or any valid CSS color string such as "#ff0000" or "rgb(0,128,255)".Slots
| Slot | Description |
|---|---|
default | The text content to render. Can contain inline HTML elements. |
TextStyleToken values
The full set of tokens available fromTextStyle:
| Token | TextStyle constant |
|---|---|
"displayLarge" | TextStyle.DisplayLarge |
"displayMedium" | TextStyle.DisplayMedium |
"displaySmall" | TextStyle.DisplaySmall |
"headlineLarge" | TextStyle.HeadlineLarge |
"headlineMedium" | TextStyle.HeadlineMedium |
"headlineSmall" | TextStyle.HeadlineSmall |
"titleLarge" | TextStyle.TitleLarge |
"titleMedium" | TextStyle.TitleMedium |
"titleSmall" | TextStyle.TitleSmall |
"bodyLarge" | TextStyle.BodyLarge |
"bodyMedium" | TextStyle.BodyMedium |
"bodySmall" | TextStyle.BodySmall |
"labelLarge" | TextStyle.LabelLarge |
"labelMedium" | TextStyle.LabelMedium |
"labelSmall" | TextStyle.LabelSmall |