Skip to content

Slider Card

custom:lcards-slider

Interactive sliders and read-only gauges for entities like lights, covers, fans, climate, and sensors. Two main visual styles: segmented pill bars and ruler gauges.


Quick Start

yaml
# Light brightness slider
type: custom:lcards-slider
entity: light.bedroom
preset: pills-basic
control:
  attribute: brightness
yaml
# Temperature gauge (read-only)
type: custom:lcards-slider
entity: sensor.temperature
preset: gauge-basic
style:
  track:
    display:
      min: -10
      max: 40
      unit: "°C"

Top-Level Options

OptionTypeDescription
typestringcustom:lcards-slider (required)
entitystringEntity to display and/or control
presetstringVisual style preset
componentstringAdvanced SVG component name
orientationstringhorizontal or vertical (default: horizontal)
idstringCard ID for rule targeting
tagslistTags for rule targeting
controlobjectControl behavior
textobjectText label definitions — see Text Fields
styleobjectVisual style overrides — see below
tap_actionobjectTap action on the card border — see Actions
hold_actionobjectHold action
double_tap_actionobjectDouble-tap action
animationslistCard animations — see Animations
background_animationlist / objectCanvas background — see Background Animations
data_sourcesobjectDataSource definitions — see DataSources
soundsobjectPer-card sound overrides

Presets

PresetDescription
pills-basicSegmented pill bar — standard interactive slider
gauge-basicRuler with tick marks — typically display-only

Additional presets and components may be available from packs.


Control Options

yaml
control:
  attribute: brightness    # Entity attribute to control (default varies by domain)
  min: 0                   # Minimum value
  max: 100                 # Maximum value
  step: 1                  # Value increment
  locked: false            # Force read-only (auto-determined by entity domain)
  invert_value: false      # Flip min↔max mapping

Automatic Domains

The slider automatically determines interactivity and attribute by entity domain:

DomainInteractiveDefault attribute
lightYesbrightness
coverYesposition
fanYespercentage
climateYestemperature
input_numberYesstate
numberYesstate
sensorNo (read-only)state

Set control.locked: true to force read-only for any domain.


style Object

style.track (pills)

FieldTypeDefaultDescription
typestringpillspills, gauge, or shaped
heightnumber / stringthemeTrack height in px or CSS value
marginnumber / objectthemeSpace around track — number (all sides) or { top, right, bottom, left }
display.minnumbercontrol.minMinimum value on visual scale
display.maxnumbercontrol.maxMaximum value on visual scale
display.unitstringentity unitDisplay unit label
invert_fillbooleanfalseFill from the opposite end
segments.countnumber15Number of pill segments
segments.gapnumber / string4Gap between pills in px
segments.shape.radiusnumber4Pill corner radius in px
segments.gradient.startstringGradient start colour
segments.gradient.endstringGradient end colour

style.track colour fields

Colour fields in style.track accept plain colour strings or state-based colour maps:

These are set inside the preset or component's colour configuration — consult the active preset's config for exact paths. Common areas:

  • Filled (active) pills: configured via the component's color or fill_color preset param
  • Unfilled (empty) pills: configured via unfilled.opacity or the component colour preset
  • Gauge progress bar: style.gauge.progress_bar.color
  • Gauge tick marks: style.gauge.scale.tick_marks.major.color, .minor.color
  • Gauge indicator: style.gauge.indicator.color

style.gauge

FieldTypeDescription
progress_bar.colorstring / objectFilled bar colour — state map supported
progress_bar.heightnumberBar cross-sectional thickness in px
progress_bar.layerstringbackground (behind ticks) or foreground (in front)
scale.tick_marks.major.intervalnumberMajor tick interval (value units)
scale.tick_marks.major.colorstring / objectMajor tick colour
scale.tick_marks.major.heightnumberMajor tick height in px
scale.tick_marks.major.widthnumberMajor tick width in px
scale.tick_marks.minor.intervalnumberMinor tick interval
scale.tick_marks.minor.colorstring / objectMinor tick colour
scale.labels.enabledbooleanShow/hide scale labels
scale.labels.colorstring / objectLabel colour
scale.labels.font_sizenumberLabel font size
indicator.typestringline, round, or triangle
indicator.colorstring / objectIndicator colour — state map supported
indicator.size.widthnumberIndicator width in px
indicator.size.heightnumberIndicator height in px
yaml
style:
  track:
    type: gauge
    height: 48
    display:
      min: -20
      max: 45
      unit: "°C"
  gauge:
    progress_bar:
      color:
        default: "var(--lcards-blue)"
        active: "var(--lcards-orange)"
      layer: background
    scale:
      tick_marks:
        major:
          interval: 10
          color: "var(--lcards-moonlight)"
          height: 12
        minor:
          interval: 5
          color: "var(--lcards-gray)"
          height: 6
      labels:
        enabled: true
        color: "var(--lcards-moonlight)"
        font_size: 10
    indicator:
      type: line
      color: "var(--lcards-orange)"

Text Labels

Sliders support the full text field system. See Text Fields for the complete reference.

yaml
text:
  default:
    font_family: "Antonio, sans-serif"
    color: "var(--lcards-moonlight)"
  label:
    content: Brightness
    position: top-left
    font_size: 11
  value:
    content: "[[[return Math.round(entity.attributes.brightness / 255 * 100) + '%']]]"
    position: top-right
    font_size: 11

style.card and style.border

Same structure as the Button card:

yaml
style:
  card:
    color:
      background: "var(--ha-card-background)"
  border:
    color:
      default: "var(--lcards-gray)"
      active: "var(--lcards-orange)"
    width: 2
    radius: 8

Annotated Example

A climate thermostat slider with custom track style, gauge ticks, text labels, and a tap action:

yaml
type: custom:lcards-slider
entity: climate.living_room
preset: gauge-basic
control:
  attribute: temperature
  min: 15
  max: 30
  step: 0.5

text:
  default:
    font_family: "Antonio, sans-serif"
    color: "var(--lcards-moonlight)"
  label:
    content: Living Room
    position: top-left
    font_size: 11
    text_transform: uppercase
  value:
    content: "[[[return entity.attributes.current_temperature + '°C']]]"
    position: top-right
    font_size: 11

style:
  track:
    type: gauge
    height: 52
    display:
      min: 15
      max: 30
      unit: "°C"
  gauge:
    progress_bar:
      color:
        default: "var(--lcards-blue)"
        heating: "var(--lcards-alert-red)"
        cooling: "var(--lcards-blue)"
      layer: background
    scale:
      tick_marks:
        major:
          interval: 5
          color: "var(--lcards-moonlight)"
          height: 14
        minor:
          interval: 1
          color: "var(--lcards-gray)"
          height: 7
      labels:
        enabled: true
        color: "var(--lcards-moonlight)"
        font_size: 10
    indicator:
      type: triangle
      color: "var(--lcards-orange)"
  border:
    color:
      default: "var(--lcards-gray)"
      active: "var(--lcards-orange)"
    width: 1

tap_action:
  action: more-info