Colors

Light

Brand

Aa
primary-solid
–
primary-on-solid
–
Aa
secondary-solid
–
secondary-on-solid
–
Aa
tertiary-solid
–
tertiary-on-solid
–
Aa
quaternary-solid
–
quaternary-on-solid
–

Status

Aa
status-success-solid
–
status-success-on-solid
–
Aa
status-warning-solid
–
status-warning-on-solid
–
Aa
status-error-solid
–
status-error-on-solid
–

Neutral

Aa
neutral-surface-1
–
neutral-on-strong
–
Aa
neutral-surface-2
–
neutral-on-strong
–
Aa
neutral-surface-3
–
neutral-on-strong
–
Aa
neutral-inverse
–
neutral-on-inverse-strong
–

Dark

Brand

Aa
primary-solid
–
primary-on-solid
–
Aa
secondary-solid
–
secondary-on-solid
–
Aa
tertiary-solid
–
tertiary-on-solid
–
Aa
quaternary-solid
–
quaternary-on-solid
–

Status

Aa
status-success-solid
–
status-success-on-solid
–
Aa
status-warning-solid
–
status-warning-on-solid
–
Aa
status-error-solid
–
status-error-on-solid
–

Neutral

Aa
neutral-surface-1
–
neutral-on-strong
–
Aa
neutral-surface-2
–
neutral-on-strong
–
Aa
neutral-surface-3
–
neutral-on-strong
–
Aa
neutral-inverse
–
neutral-on-inverse-strong
–

Button

Pattern
.btn + [style] + [color] + [size] + [shape] + [state]
Styles
solid (default), btn-muted, btn-outline, btn-text
Colors
btn-primary, btn-secondary, btn-tertiary, btn-success, btn-warning, btn-error
Sizes
btn-sm, medium (default), btn-lg
Shapes
btn-circle, btn-square, btn-wide, btn-block
States
btn-active, disabled
Example
<button class="btn btn-primary btn-lg">Save</button>

Styles and colors

A style changes how the color is applied. Combine .btn-[style] with .btn-[color].

Style Default Primary Secondary Tertiary Success Warning Error
Soliddefault
Muted.btn-muted
Outline.btn-outline
Text.btn-text

Sizes

.btn-sm
.btn
.btn-lg

Shapes

Circle and square buttons keep a 1:1 ratio in every size. The circle is fully rounded, the square has no rounding.

.btn-circle.btn-sm
.btn-circle
.btn-circle.btn-lg
.btn-square.btn-sm
.btn-square
.btn-square.btn-lg
.btn-wide
.btn-block

States

default
.btn-active
disabled

Badge

Pattern
.badge + [style] + [color] + [size] + [shape]
Styles
solid (default), badge-muted, badge-outline, badge-dashed
Colors
badge-primary, badge-secondary, badge-tertiary, badge-success, badge-warning, badge-error
Sizes
badge-sm, medium (default), badge-lg
Shapes
rounded (default), badge-pill, badge-square
Example
<span class="badge badge-success badge-muted badge-lg">Active</span>

Styles and colors

A style changes how the color is applied. Combine .badge-[style] with .badge-[color].

Style Default Primary Secondary Tertiary Success Warning Error
Soliddefault Solid Solid Solid Solid Solid Solid Solid
Muted.badge-muted Muted Muted Muted Muted Muted Muted Muted
Outline.badge-outline Outline Outline Outline Outline Outline Outline Outline
Dashed.badge-dashed Dashed Dashed Dashed Dashed Dashed Dashed Dashed

Sizes

Small
.badge-sm
Default
.badge
Large
.badge-lg

Shapes

Rounded
.badge
Pill
.badge-pill
Square
.badge-square

Link

Pattern
.link + [color] + [size] + [underline] + [special]
Colors
neutral (default), link-primary, link-secondary, link-tertiary, link-success, link-warning, link-error
Sizes
link-sm, medium (default), link-lg
Underline
always (default), link-underline-hover, link-underline-animate, link-underline-none
Special
link-external, link-disabled
Example
<a class="link link-primary link-lg link-underline-animate">Read more</a>

Underline and colors

Links change color on hover. .link-underline-none keeps the text neutral until hover.

Underline Default Primary Secondary Tertiary Success Warning Error
Underlinedefault Underline Underline Underline Underline Underline Underline Underline
Hover.link-underline-hover Hover Hover Hover Hover Hover Hover Hover
Animate.link-underline-animate Animate Animate Animate Animate Animate Animate Animate
None.link-underline-none None None None None None None None

Sizes

Small
.link-sm
Default
.link
Large
.link-lg

Special

.link-external appends an external icon, .link-disabled mutes the link and blocks pointer events.

External
.link-external
Disabled
.link-disabled

Card

Pattern
.card + [style] + [color] + [size] + [layout] + [interactive]
Parts
card-media (image or video), card-body, card-title (headline)
Styles
solid (default), card-muted, card-outline, card-glass
Colors
card-primary, card-secondary, card-tertiary, card-success, card-warning, card-error
Sizes
card-sm, medium (default), card-lg
Layouts
card-reverse, card-side, card-side-reverse, card-media-background, each also as layout-*
Interactive
card-hover, card-grow
Example
<div class="card card-muted card-primary card-side"><div class="card-media media">…</div><div class="card-body">…</div></div>

Structure

An element with Show as card renders a media part, a body with the headline as .card-title, the text and the call to action.

Body only

The body sets the padding and the gap between its children.

.card-body

With media

The media runs edge to edge.

.card-media + .card-body

With call to action

The buttons follow the text.

.card-body > .cta-outer
<div class="card media_text responsive-body-sm">
    <div class="card-media media-image media">
        <figure><img src="…" alt="…"></figure>
    </div>
    <div class="card-body responsive-body-sm text">
        <h3 class="card-title responsive-headline-sm">Headline</h3>
        <div class="rte"><p>Text</p></div>
        <div class="cta-outer inline-flex flex-wrap gap-2 md:gap-4 mt-3">
            <a href="…" class="btn btn-primary">Read more</a>
        </div>
    </div>
</div>

Styles and colors

A style changes how the color is applied. Combine .card-[style] with .card-[color].

Style Default Primary Secondary Tertiary Success Warning Error
Soliddefault
Solid
Solid
Solid
Solid
Solid
Solid
Solid
Muted.card-muted
Muted
Muted
Muted
Muted
Muted
Muted
Muted
Outline.card-outline
Outline
Outline
Outline
Outline
Outline
Outline
Outline

Glass

Glass blurs what lies behind it, so it needs an image or a colorful background.

Default
Primary
Secondary
Tertiary
Success
Warning
Error
.card-glass, .card-glass.card-[color]

Sizes

The size sets the padding and the gap of the body.

Small

Padding and gap grow with the size.

.card-sm

Default

Padding and gap grow with the size.

.card

Large

Padding and gap grow with the size.

.card-lg

Layouts

The side and background layouts style the > .media child. Elements that are not shown as a card get the same layouts as .layout-*.

Default

Media and body in one card.

.card

Reverse

Media and body in one card.

.card-reverse

Media background

Media and body in one card.

.card-media-background

Side

From the small breakpoint on, the media takes two fifths of the width. Below it, the card stacks.

.card-side

Side reverse

From the small breakpoint on, the media takes two fifths of the width. Below it, the card stacks.

.card-side-reverse

Interactive

For cards that are links. Both effects also apply on keyboard focus and add a focus ring.

Alert

Pattern
.alert + [style] + [color] + [size]
Sections
alert-icon, alert-content, alert-title, alert-description
Styles
solid (default), alert-muted, alert-outline, alert-dashed
Colors
alert-primary, alert-secondary, alert-tertiary, alert-success, alert-warning, alert-error
Sizes
alert-sm, medium (default), alert-lg
Example
<div class="alert alert-success alert-muted alert-lg">…</div>

Structure

Content goes in .alert-content. Icon, title and description are optional.

A simple alert with content only.
.alert > .alert-content
An icon makes the message easier to recognize.
.alert > .alert-icon + .alert-content > .alert-description
Saved
Your changes have been saved.
.alert-content > .alert-title + .alert-description
Action required
Please review your settings before you continue.
.alert > .alert-icon + .alert-content > .alert-title + .alert-description

Styles and colors

A style changes how the color is applied. Combine .alert-[style] with .alert-[color].

Color Solid Muted Outline Dashed
Default.alert
Solid
Muted
Outline
Dashed
Primary.alert-primary
Solid
Muted
Outline
Dashed
Secondary.alert-secondary
Solid
Muted
Outline
Dashed
Tertiary.alert-tertiary
Solid
Muted
Outline
Dashed
Success.alert-success
Solid
Muted
Outline
Dashed
Warning.alert-warning
Solid
Muted
Outline
Dashed
Error.alert-error
Solid
Muted
Outline
Dashed

Sizes

Small
Padding, gap, icon and text scale with the size.
.alert-sm
Default
Padding, gap, icon and text scale with the size.
.alert
Large
Padding, gap, icon and text scale with the size.
.alert-lg

Pagination

Pattern
.pagination + [size] + [shape]
Markup
nav.pagination > [p] + ul > li > (a | strong), as rendered by the Contao pagination
Sizes
pagination-sm, medium (default), pagination-lg
Shapes
rounded (default), pagination-circle, pagination-square
States
current strong, a[aria-current="page"], a.active; disabled .disabled, [disabled]
Example
<nav class="pagination pagination-sm pagination-circle">…</nav>

Sizes

.pagination-sm
.pagination
.pagination-lg

Shapes

.pagination
.pagination-circle
.pagination-square

Icons

States

Items use the neutral surface, the current page the primary color.

strong current, .disabled previous

Breadcrumb

Classes

Pattern
.breadcrumb + [color] + [size]
Base
breadcrumb, or mod_breadcrumb on the Contao module (add modifiers in its CSS class field)
Colors
breadcrumb-primary, breadcrumb-secondary, breadcrumb-tertiary, breadcrumb-success, breadcrumb-warning, breadcrumb-error, the hover color of links and the ellipsis (default primary)
Sizes
breadcrumb-sm, medium (default), breadcrumb-lg, also applied to the collapsed dropdown
Parts
breadcrumb-separator (SVG or text), breadcrumb-ellipsis, breadcrumb-ellipsis-btn and breadcrumb-dropdown (created by the controller)
States
aria-current="page" or active on the current li
Example
<nav class="breadcrumb breadcrumb-secondary breadcrumb-sm" aria-label="Breadcrumb">…</nav>

Stimulus controller

Controller
data-controller="breadcrumb" on the nav
Targets
list on the ul, item on every collapsible li
Values
max-items collapses when there are more items (default 4), breakpoint collapses below this viewport width in px (default 640)
Behavior
Checked once on page load, not on resize. Collapsing hides every item and lists it in a popover behind an ellipsis button. Entries without the target, like home and the current page, stay visible.
Example
<nav class="breadcrumb" data-controller="breadcrumb" data-breadcrumb-max-items-value="3">

Responsive collapse

Four items do not exceed the default of four, so this trail is expanded on wide screens and collapsed below 640px. Reload after resizing.

data-controller="breadcrumb"

Colors

data-breadcrumb-max-items-value="3" forces the collapse. Hover the links and the ellipsis to see the color.

Sizes

Open the ellipsis to see the dropdown follow the size.

Popover and dropdown

Classes

Pattern
.popover-content + [preset] + [size]
Presets
popover-dropdown, popover-tooltip
Sizes
popover-sm, medium (default), popover-lg
Arrow
popover-arrow (optional, positioned by the controller)
Menu
dropdown-menu, dropdown-item, dropdown-item-shortcut, dropdown-separator, dropdown-label
States
active or aria-selected="true", disabled or aria-disabled="true" on a dropdown-item
Example
<div class="popover-content popover-tooltip popover-sm" data-popover-target="content">Hint</div>

Stimulus controller

Controller
data-controller="popover" on the wrapper
Targets
trigger, content, arrow
Values
placement top, bottom (default), left, right · alignment start, center (default), end · trigger click (default), hover · offset gap in px (default 8) · flip at the viewport edge (default true)
Actions
click->popover#toggle on a click trigger, click->popover#close on a close button
Events
popover:opened, popover:closed
Behavior
Closes on an outside click and on Escape, repositions on scroll and resize
Example
<div data-controller="popover" data-popover-placement-value="top">

Placement

Set with data-popover-placement-value. A click trigger needs data-action="click->popover#toggle".

Placement: top
placement="top"
Placement: bottom
placement="bottom"
Placement: left
placement="left"
Placement: right
placement="right"

Alignment

Set with data-popover-alignment-value. Aligns the popover along the placement axis.

Aligned to start
alignment="start"
Aligned to center
alignment="center"
Aligned to end
alignment="end"

Trigger

Set with data-popover-trigger-value. Hover works without an action, click needs one.

Click triggered
trigger="click"
Hover triggered
trigger="hover"

Presets

Default style
.popover-content
.popover-dropdown
Tooltip style
.popover-tooltip

Sizes

Small popover
.popover-sm
Default popover
.popover-content
Large popover
.popover-lg

Tooltip sizes

.popover-tooltip has its own, smaller scale.

Small tooltip
.popover-tooltip.popover-sm
Default tooltip
.popover-tooltip
Large tooltip
.popover-tooltip.popover-lg

Dropdown menu

Combine .popover-dropdown with the menu classes.

Interactive content

Popovers can hold forms and buttons. A button with data-action="click->popover#close" closes it.

Dimensions Set the dimensions for the layer.
Form
Delete this item? This action cannot be undone.
Confirmation

Input

Pattern
.form-input + [style] + [color] + [size] + [state]
Styles
outline (default), input-muted
Colors
input-primary, input-secondary, input-tertiary, input-success, input-warning, input-error
Sizes
input-sm, medium (default), input-lg
Labels
label-text, label-required, helper-text, success-text, error-text
Floating label
input-floating > form-input + input-floating-label
Icons
input-group + has-icon-left / has-icon-right > input-icon
States
is-valid, is-invalid, disabled, readonly
Example
<input class="form-input input-primary input-lg" placeholder="Enter text">

Structure

A field is a .label-text, the input and an optional .helper-text below it.

We will never share your email.
.label-text + .form-input + .helper-text
.label-text.label-required

Styles and colors

The color tints the border and the focus ring, .input-muted adds a tinted background.

Style Default Primary Secondary Tertiary Success Warning Error
Outlinedefault
Muted.input-muted

Sizes

.input-sm
.form-input
.input-lg

Floating label

The label sits inside the field and moves onto the border on focus or once the field has a value. Set placeholder=" ", a real placeholder only shows while the field is focused.

.input-floating
.input-floating .input-primary
placeholder="you@example.com"

Limitations

The floated label covers the border with its own background, bg-neutral-surface-1 by default. On another background, add the same class to .input-floating: bg-neutral-surface-{1|2|3}, bg-{primary|secondary|tertiary}-solid or bg-status-{success|warning|error}-solid. Opacity variants such as bg-primary/10 are not supported.

Avoid .input-muted with a floating label: the tinted field and the solid label background do not match.

Avoid: .input-muted

Icons

Wrap the input in .input-group with .has-icon-left and/or .has-icon-right. Each icon is a .input-icon before or after the input.

.input-group.has-icon-left
.input-group.has-icon-right
.has-icon-left.has-icon-right

States

Username is available.
.is-valid + .success-text
Use at least 8 characters.
.is-invalid + .error-text
disabled
readonly

Input number

Classes

Pattern
[layout] > .form-input + [style] + [color] + [size], plus two .input-number-btn
Layouts
input-number (buttons right), input-number-center (buttons on both sides)
Styles
outline (default), input-muted on the input
Colors
input-primary, input-secondary, input-tertiary, input-success, input-warning, input-error on the input, the buttons follow
Sizes
input-sm, medium (default), input-lg on the input, the buttons follow
States
disabled on the input and both buttons

Stimulus controller

Controller
data-controller="input-number" on the layout wrapper
Target
data-input-number-target="input" on the input
Actions
click->input-number#decrement and click->input-number#increment on the buttons, input->input-number#inputChanged on the input
Attributes
min, max and step on the input

Layouts

The HTML order sets the layout: the buttons follow the input in .input-number and surround it in .input-number-center.

.input-number
.input-number-center
<div class="input-number" data-controller="input-number">
    <input type="number" class="form-input" data-input-number-target="input" data-action="input->input-number#inputChanged" value="1" min="0" max="100">
    <button type="button" class="input-number-btn" data-action="click->input-number#decrement">−</button>
    <button type="button" class="input-number-btn" data-action="click->input-number#increment">+</button>
</div>

<div class="input-number-center" data-controller="input-number">
    <button type="button" class="input-number-btn" data-action="click->input-number#decrement">−</button>
    <input type="number" class="form-input" data-input-number-target="input" data-action="input->input-number#inputChanged" value="1" min="0" max="100">
    <button type="button" class="input-number-btn" data-action="click->input-number#increment">+</button>
</div>

Styles and colors

Style and color classes go on the input, the buttons pick up the color automatically.

Layout Default Primary Secondary Tertiary Success Warning Error
Buttons right, outline.input-number
Centered, outline.input-number-center
Buttons right, muted.input-number + .input-muted
Centered, muted.input-number-center + .input-muted

Sizes

The buttons scale with the size class of the input.

.input-sm
.form-input
.input-lg

Min, max and step

The controller reads min, max and step from the input and disables a button once its limit is reached.

min="0" max="10"
step="5"
step="0.5"

States

disabled

Textarea

Pattern
.form-textarea + [style] + [color] + [size] + [resize] + [state]
Styles
outline (default), textarea-muted
Colors
textarea-primary, textarea-secondary, textarea-tertiary, textarea-success, textarea-warning, textarea-error
Sizes
textarea-sm, medium (default), textarea-lg
Labels
label-text, label-required, helper-text, success-text, error-text
Floating label
textarea-floating > form-textarea + textarea-floating-label
Resize
vertical (default), resize-none, resize-x, resize-both
States
is-valid, is-invalid, disabled, readonly
Example
<textarea class="form-textarea textarea-primary" placeholder="Enter message"></textarea>

Structure

A field is a .label-text, the textarea and an optional .helper-text below it.

Maximum 500 characters.
.label-text + .form-textarea + .helper-text
.label-text.label-required

Styles and colors

The color tints the border and the focus ring, .textarea-muted adds a tinted background.

Style Default Primary Secondary Tertiary Success Warning Error
Outlinedefault
Muted.textarea-muted

Sizes

A size sets the padding, the font size and the minimum height.

.textarea-sm
.form-textarea
.textarea-lg

Floating label

The label sits in the first line and moves onto the border on focus or once the field has a value. Set placeholder=" ". The background limitations of the input floating label apply here too.

.textarea-floating
.textarea-floating .textarea-primary

Resize

Textareas resize vertically by default.

.resize-none
.resize-x
.resize-both

States

Looks good.
.is-valid + .success-text
Description is required.
.is-invalid + .error-text
disabled
readonly

Select

Pattern
.form-select + [style] + [color] + [size] + [state]
Styles
outline (default), select-muted
Colors
select-primary, select-secondary, select-tertiary, select-success, select-warning, select-error
Sizes
select-sm, medium (default), select-lg
Labels
label-text, label-required, helper-text, success-text, error-text
Floating label
select-floating > form-select + select-floating-label
Icons
select-group + has-icon-left > select-icon (leading only)
States
is-valid, is-invalid, disabled
Example
<select class="form-select select-primary select-lg">…</select>

Structure

A field is a .label-text, the select and an optional .helper-text below it. An empty first option is shown in the placeholder color.

Select your preferred category.
.label-text + .form-select + .helper-text
.label-text.label-required
<optgroup label="…">

Styles and colors

The color tints the border and the focus ring, .select-muted adds a tinted background.

Style Default Primary Secondary Tertiary Success Warning Error
Outlinedefault
Muted.select-muted

Sizes

.select-sm
.form-select
.select-lg

Floating label

Unlike the input, the label always stays floated, since a select always shows a value. The background limitations of the input floating label apply here too.

.select-floating
.select-floating .select-primary

Icons

Wrap the select in .select-group.has-icon-left with a .select-icon before it. The icon spacing follows the size. There is no trailing icon, that side holds the arrow.

.select-group.has-icon-left .select-sm
.select-group.has-icon-left
.select-group.has-icon-left .select-lg

States

Selection confirmed.
.is-valid + .success-text
Please make a selection.
.is-invalid + .error-text
disabled

Checkbox

Pattern
.form-checkbox + [color] + [size]
Colors
checkbox-primary, checkbox-secondary, checkbox-tertiary, checkbox-success, checkbox-warning, checkbox-error
Sizes
checkbox-sm, medium (default), checkbox-lg
States
checked, indeterminate (JavaScript), disabled
Markup
span > input + label, as Contao renders every option
Example
<span><input type="checkbox" id="terms" class="form-checkbox checkbox-primary"><label for="terms">I agree</label></span>

Colors

The color sets the border and fills the box once it is checked.

.form-checkbox
.checkbox-primary
.checkbox-secondary
.checkbox-tertiary
.checkbox-success
.checkbox-warning
.checkbox-error

Sizes

The label next to the checkbox scales with it.

.checkbox-sm
.form-checkbox
.checkbox-lg

States

Indeterminate is a property, not an attribute. It is set with element.indeterminate = true and shows a line instead of the checkmark.

default
checked
indeterminate
disabled
checked disabled

Radio

Pattern
.form-radio + [color] + [size]
Colors
radio-primary, radio-secondary, radio-tertiary, radio-success, radio-warning, radio-error
Sizes
radio-sm, medium (default), radio-lg
States
checked, disabled
Markup
span > input + label, as Contao renders every option
Example
<span><input type="radio" name="plan" id="plan-basic" class="form-radio radio-primary"><label for="plan-basic">Basic</label></span>

Colors

The color sets the ring and the dot.

.form-radio
.radio-primary
.radio-secondary
.radio-tertiary
.radio-success
.radio-warning
.radio-error

Sizes

The label next to the radio scales with it.

.radio-sm
.form-radio
.radio-lg

States

Radios with the same name form a group, checking one unchecks the others.

default
checked
disabled
checked disabled

Switch

Pattern
.form-switch + [style] + [color] + [size]
Styles
solid (default), switch-outline
Colors
switch-primary, switch-secondary, switch-tertiary, switch-success, switch-warning, switch-error
Sizes
switch-sm, medium (default), switch-lg
States
checked, disabled
Markup
label > input + span. Contao form fields render checkboxes, the switch is for custom markup.
Example
<label><input type="checkbox" class="form-switch switch-primary"><span>Notifications</span></label>

Styles and colors

The color fills the track once the switch is on. Outline keeps the track transparent and colors the border and the thumb.

Style Default Primary Secondary Tertiary Success Warning Error
Soliddefault
Outline.switch-outline

Sizes

.switch-sm
.form-switch
.switch-lg

States

default
checked
disabled
checked disabled

Range

Classes

Pattern
.widget-range + [color] > .form-range + [size] + [fill]
Colors
range-primary, range-secondary, range-tertiary, range-success, range-warning, range-error, on the wrapper
Sizes
range-sm, medium (default), range-lg, on the input
Fill
range-fill on the input, needs the range controller
Helper
range-color sets the text color to the wrapper color
States
disabled
Wrapper
Contao renders every range field inside .widget.widget-range and puts the field color there. The fill and the value display are siblings of the input and inherit the color from the wrapper.
Example
<div class="widget-range range-primary"><input type="range" class="form-range range-lg"></div>

Colors

Without the fill, the color shows on the thumb.

.widget-range
.range-primary
.range-secondary
.range-tertiary
.range-success
.range-warning
.range-error

Sizes

.range-sm
.form-range
.range-lg

States

default
disabled

Stimulus controller

The range controller fills the track up to the thumb and shows the current value.

Controller
data-controller="range" on the .widget-range wrapper
Targets
data-range-target="input" with data-action="input->range#update" on the input, data-range-target="value" (optional) on the element that shows the value
Values
data-range-suffix-value is appended to the value, e.g. %. data-range-locale-value sets the number format, the browser locale is the default.
Fill
The controller sets --range-fill-percent on the input, .range-fill paints it

Fill

.range-fill
.range-primary .range-fill
.range-secondary .range-fill
.range-tertiary .range-fill
.range-success .range-fill
.range-warning .range-fill
.range-error .range-fill

Value display

.range-color gives the value the wrapper color. The fill is optional, min, max and step work as usual.

22
value only
75
value and fill
50
10 GB 100 GB
step="10"
<div class="widget-range range-success" data-controller="range" data-range-suffix-value=" GB">
    <label class="label-text" for="storage">Storage limit</label>
    <span class="range-color" data-range-target="value">50</span>
    <input type="range" id="storage" class="form-range range-fill range-lg"
        data-range-target="input"
        data-action="input->range#update"
        min="10" max="100" step="10" value="50">
</div>

Theme toggle

Toggle template

Template
@Contao/kiss_component/theme/_toggle.html.twig, brings its own theme controller
Variables
size in px (default 24), class, attributes, button_attributes
Block
theme_toggle_icon
Classes
theme-toggle on the button, theme-toggle__icon on the SVG
Animation
The sun rays scale down and fade out, a mask slides in to form the crescent, the icon tilts by −45° in dark mode and wiggles on hover, all with spring easing

Stimulus controller

Controller
data-controller="theme"
Modes
light, dark, system (follows the OS preference, used when nothing is stored)
Actions
theme#toggle switches between light and dark (and leaves system mode), theme#set sets the mode from the input's value
Targets
toggle (checked in dark mode), radio and select (synced with the mode), lightIcon and darkIcon (shown in their mode)
Values
storage-key, the localStorage key (default theme)
Events
theme:change with { mode, theme, isDark } on the element and the document
Sync
Every theme controller on the page stays in sync

Sun and moon toggle

Include the template, no further setup is needed.

default (24)
size: 32
size: 48
{{ include('@Contao/kiss_component/theme/_toggle.html.twig') }}
{{ include('@Contao/kiss_component/theme/_toggle.html.twig', {size: 32}) }}
{{ include('@Contao/kiss_component/theme/_toggle.html.twig', {class: 'my-class'}) }}

Light and dark

Two-way controls call theme#toggle. A toggle target is checked while dark mode is active.

.form-switch
.form-checkbox
lightIcon, darkIcon
<label data-controller="theme">
    <input type="checkbox" class="form-switch" data-theme-target="toggle" data-action="change->theme#toggle">
</label>

<button class="btn" data-controller="theme" data-action="click->theme#toggle">
    <span data-theme-target="lightIcon">Light mode</span>
    <span data-theme-target="darkIcon" style="display: none;">Dark mode</span>
</button>

Light, dark and system

Three-way controls add system, which follows the OS preference. They call theme#set, which reads the input's value, and the controller selects the stored mode on page load.

select target
radio target
Segmented control
Pill buttons

The segmented control and the pill buttons hide the radios with .sr-only, which keeps them accessible. .peer on the input lets peer-checked: utilities style the visible sibling.

Events

document.addEventListener('theme:change', (event) => {
    console.log(event.detail); // { mode: 'dark', theme: 'dark', isDark: true }
});

Date range picker

Overview

Pattern
[data-controller="date-range-picker"] > input.form-input + input.form-input
Library
vanillajs-datepicker (DateRangePicker)
Inputs
The first two inputs inside the wrapper become the start and the end field
Behaviour
The calendar highlights the range between both dates. Past dates are disabled (minDate is today).
Styles
The popup uses the library stylesheet. Import vanillajs-datepicker/css/datepicker.css with layer(components) in the project.

Date range

data-controller="date-range-picker"
<div data-controller="date-range-picker">
    <input type="text" class="form-input date-from" placeholder="Arrival">
    <input type="text" class="form-input date-to" placeholder="Departure">
</div>

Stimulus controller

Controller
data-controller="date-range-picker" on the wrapper around both inputs
Values
data-date-range-picker-format-value sets the date format, e.g. yyyy-mm-dd. data-date-range-picker-language-value sets the locale, e.g. de. The page language is the default, English the fallback.