Skip to content

Slider Card

custom:lcards-slider

Interactive sliders and read-only gauges for entities like lights, covers, fans, climate, and sensors. Three main visual styles: segmented pill bars, ruler gauges, and shaped (clip-path fill).


Quick Start

yaml
# Light brightness slider
type: custom:lcards-slider
entity: light.bedroom
preset: pills-left-border
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
ranges_attributestringEntity attribute used for above:/below:/between: range conditions — see Range Conditions
presetstringVisual style preset
componentstringAdvanced SVG component name (shaped for clip-path fill style)
heightnumber / stringCard height — see Sizing
widthnumber / stringCard width — see Sizing
min_heightnumber / stringMinimum card height — see Sizing
min_widthnumber / stringMinimum card width — see Sizing
triggers_updatelistExtra entity IDs that trigger re-render — see Data Sources
idstringCard ID for Rules Engine targeting
tagslistTags for Rules Engine targeting
controlobjectControl behavior — see Control Options
textobjectText label definitions — see Text Fields
styleobjectVisual style overrides — see Style Object
grid_optionsobjectHA grid layout — see grid_options
tap_actionobjectTap action — see Actions
hold_actionobjectHold action — see Actions
double_tap_actionobjectDouble-tap action — see Actions
animationslistCard animations — see Animations
background_animationlist / objectCanvas background — see Background Animations
data_sourcesobjectNamed data source definitions — see Data Sources
soundsobjectPer-card sound overrides — see Sound Effects

Presets

PresetDescription
pills-basicSegmented pill slider (horizontal, default)
pills-left-borderPills slider with left border cap
pills-left-border-roundedPills + left border, right end rounded for LCARS end-cap look
gauge-basicRuler-style gauge with tick marks and progress bar
gauge-left-borderGauge with left border cap; marker indicators pinned to tick edge
gauge-left-border-roundedGauge + left border, right end rounded
shaped-verticalVertical lozenge fill with top/bottom text bands (component: shaped)
shaped-horizontalHorizontal lozenge fill with left/right text bands (component: shaped)
picard-gauge-verticalPicard-style vertical gauge (component: picard)

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
FieldTypeDefaultDescription
attributestringdomain defaultEntity attribute to control
minnumberdomain defaultMinimum value
maxnumberdomain defaultMaximum value
stepnumberdomain defaultValue increment
lockedbooleanautoForce read-only (true) or interactive (false)
invert_valuebooleanfalseFlip the min↔max mapping

Automatic Domain Behaviour

The slider auto-detects interactivity and default attribute from the entity domain:

DomainInteractiveDefault attributeControl range
lightYesbrightness0 – 100 (%)
coverYescurrent_position0 – 100
fanYespercentage0 – 100
climateYestemperaturemin_tempmax_temp from entity
water_heaterYestemperaturemin_tempmax_temp from entity
media_playerYesvolume_level0.0 – 1.0
humidifierYeshumiditymin_humiditymax_humidity
valveYescurrent_valve_position0 – 100
input_numberYesstateentity min/max/step
numberYesstateentity min/max/step
sensorNo (read-only)state

All other domains default to read-only (locked). Set control.locked: true/false to override.


Style Object

style.track

FieldTypeDefaultDescription
typestringpreset defaultpills, gauge, or shaped
orientationstringhorizontalhorizontal or vertical
heightnumber / stringthemeTrack height in px or CSS value
marginnumber / objectthemeSpace around track — number (all sides) or { top, right, bottom, left }
invert_fillbooleanfalseFill from the opposite end (right/top instead of left/bottom)
display.minnumbercontrol.minMinimum value shown on visual scale
display.maxnumbercontrol.maxMaximum value shown on visual scale
display.unitstringentity unitDisplay unit — overrides entity unit_of_measurement
segments.enabledbooleantrueEnable pill segments (pills mode)
segments.countnumber15Number of pill segments
segments.gapnumber / string4Gap between pills in px
segments.shape.radiusnumber4Pill corner radius in px
segments.size.widthnumber12Fixed pill width in px (horizontal orientation)
segments.size.heightnumber12Fixed pill height in px (vertical orientation)
segments.gradient.startstringGradient start colour
segments.gradient.endstringGradient end colour
segments.appearance.filled.opacitynumberOpacity of filled pills (0–1)
segments.appearance.unfilled.opacitynumberOpacity of unfilled pills (0–1)

style.gauge

FieldTypeDefaultDescription
colorstring / objectPrimary gauge fill colour — shorthand, takes priority over progress_bar.color. Supports state maps.
progress_bar.colorstring / objectthemeFilled bar colour — state map supported
progress_bar.heightnumberthemeBar cross-sectional thickness in px
progress_bar.layerstringbackgroundbackground (behind ticks) or foreground (in front)
progress_bar.alignstringmiddleCross-axis alignment: start, middle, or end
progress_bar.paddingobjectFine-tune offset from aligned position: { top, right, bottom, left }
progress_bar.radiusnumber / objectCorner radius in px, or { start, end } per-end
progress_bar.background.colorstring / objectBackground track colour (drawn behind fill)
progress_bar.background.heightnumbersame as barBackground track cross-section in px
progress_bar.background.radiusnumber / objectBackground track corner radius or { start, end }
progress_bar.background.minnumbercontrol.minValue where background track starts
progress_bar.background.maxnumbercontrol.maxValue where background track ends
scale.tick_marks.major.enabledbooleantrueShow major ticks
scale.tick_marks.major.intervalnumberMajor tick interval in value units
scale.tick_marks.major.colorstring / objectthemeMajor tick colour
scale.tick_marks.major.heightnumberMajor tick height in px
scale.tick_marks.major.widthnumberMajor tick width in px
scale.tick_marks.minor.enabledbooleantrueShow minor ticks
scale.tick_marks.minor.intervalnumberMinor tick interval in value units
scale.tick_marks.minor.colorstring / objectthemeMinor tick colour
scale.tick_marks.minor.heightnumberMinor tick height in px
scale.tick_marks.minor.widthnumberMinor tick width in px
scale.labels.enabledbooleantrueShow scale value labels
scale.labels.show_unitbooleantrueAppend unit suffix to labels
scale.labels.unitstringentity unitOverride unit suffix on labels
scale.labels.colorstring / objectthemeLabel colour
scale.labels.font_sizenumberLabel font size in px
scale.labels.paddingnumberLabel padding in px
indicator.enabledbooleantrueShow current value indicator
indicator.typestringlineline, round, or triangle
indicator.colorstring / objectthemeIndicator colour — state map supported
indicator.size.widthnumberIndicator width in px
indicator.size.heightnumberIndicator height in px
indicator.rotationnumber0Rotation angle in degrees (triangle type)
indicator.offset.xnumberHorizontal position offset in px
indicator.offset.ynumberVertical position offset in px
indicator.border.enabledbooleanShow indicator border
indicator.border.widthnumberIndicator border width in px
indicator.border.colorstring / objectIndicator border colour
marker_indicator.typestringtriangleDefault shape for value-marker range indicators
marker_indicator.alignstringcenterCross-axis alignment for markers: start, center, end
marker_indicator.size.widthnumber20Default marker width in px
marker_indicator.size.heightnumber20Default marker height in px
marker_indicator.rotationnumber180Default marker rotation in degrees
marker_indicator.offset.xnumberHorizontal offset in px
marker_indicator.offset.ynumberVertical offset in px
marker_indicator.colorstring / objectrange colourDefault marker colour
marker_indicator.border.enabledbooleanShow marker border
marker_indicator.border.widthnumberMarker border width in px
marker_indicator.border.colorstring / objectMarker border colour
yaml
style:
  track:
    type: gauge
    orientation: horizontal
    height: 48
    display:
      min: -20
      max: 45
      unit: "°C"
  gauge:
    color: "var(--lcards-blue)"
    progress_bar:
      layer: background
      align: middle
      radius: 4
      background:
        color: "var(--lcards-black-medium)"
    scale:
      tick_marks:
        major:
          interval: 10
          color: "var(--lcards-moonlight)"
          height: 12
          width: 2
        minor:
          interval: 5
          color: "var(--lcards-gray)"
          height: 6
          width: 1
      labels:
        enabled: true
        show_unit: true
        color: "var(--lcards-moonlight)"
        font_size: 10
    indicator:
      type: line
      color: "var(--lcards-orange)"

Ranges

Define colour-coded value bands and point markers on the track. Two item types:

  • Band (min + max): coloured background zone
  • Marker (value): live point indicator that tracks a value
yaml
style:
  ranges:
    - min: 0
      max: 20
      color: "var(--error-color)"
      opacity: 0.3
    - min: 20
      max: 80
      color: "var(--success-color)"
      opacity: 0.3
    - min: 80
      max: 100
      color: "var(--warning-color)"
      opacity: 0.3
    # Value marker — triangle at a live entity value
    - value: "{entity.attributes.target_temp}"
      color: "var(--lcards-orange)"

Range band fields

FieldTypeDefaultDescription
minnumber / stringrequiredBand start value — supports templates: {entity.attributes.x}, [[[JS]]]
maxnumber / stringrequiredBand end value — supports templates
colorstringBand fill colour
opacitynumber0.3Band opacity (0–1)

Value marker fields

FieldTypeDefaultDescription
valuenumber / stringrequiredPosition value — supports templates: {entity.attributes.x}, {states.id.state}, [[[JS]]]
colorstringMarker colour
indicator.typestringtriangleShape: line, round, triangle
indicator.alignstringcenterCross-axis pin: start, center, end
indicator.size.widthnumber20Width in px
indicator.size.heightnumber20Height in px
indicator.rotationnumber180Rotation in degrees
indicator.offset.xnumberHorizontal offset in px
indicator.offset.ynumberVertical offset in px
indicator.border.enabledbooleanShow border on indicator
indicator.border.colorstringBorder colour
indicator.border.widthnumberBorder width in px
pill_style.strokebooleantruePills mode: outline on marker pill
pill_style.stroke_widthnumber2Pills mode: outline thickness in px

Global marker defaults can be set at style.gauge.marker_indicator — individual range entries override per field.


Shaped Component

Use component: shaped for a solid fill clipped to a geometric shape.

yaml
type: custom:lcards-slider
entity: light.bedroom
component: shaped
style:
  shaped:
    type: lozenge       # lozenge | rect | rounded | diamond | hexagon | polygon | path
    fill:
      color: "var(--lcards-blue)"
    track:
      background: "var(--lcards-black-medium)"
    text_bands:
      top:
        size: 36
      bottom:
        size: 28
FieldTypeDefaultDescription
style.shaped.typestringlozengeShape: lozenge, rect, rounded, diamond, hexagon, polygon, path
style.shaped.radiusnumberautoCorner radius override in px
style.shaped.fill.colorstringthemeFill colour for the active portion
style.shaped.track.backgroundstringthemeInterior background (empty portion) colour
style.shaped.text_bands.top.sizenumber36Top text band height in px (vertical mode)
style.shaped.text_bands.bottom.sizenumber28Bottom text band height in px (vertical mode)
style.shaped.text_bands.left.sizenumber60Left text band width in px (horizontal mode)
style.shaped.text_bands.right.sizenumber60Right text band width in px (horizontal mode)
style.shaped.polygon.pointsarray[[xPct, yPct], ...] vertices (0–1) for polygon shape
style.shaped.path.dstringRaw SVG path d attribute (absolute coords)
style.shaped.path.translatebooleanfalseTranslate path to shape body origin

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.border

The slider border is a per-side cap system — each side is configured independently. This differs from the button card border structure.

FieldTypeDescription
border.radiusnumber / string / objectUniform corner radius in px, a CSS variable string, or { top_left, top_right, bottom_right, bottom_left } per-corner
border.left.enabledbooleanEnable left border cap
border.left.sizenumberLeft border width in px
border.left.colorstring / objectLeft border colour — state map supported
border.right.enabledbooleanEnable right border cap
border.right.sizenumberRight border width in px
border.right.colorstring / objectRight border colour
border.top.enabledbooleanEnable top border cap
border.top.sizenumberTop border height in px
border.top.colorstring / objectTop border colour
border.bottom.enabledbooleanEnable bottom border cap
border.bottom.sizenumberBottom border height in px
border.bottom.colorstring / objectBottom border colour
yaml
style:
  border:
    radius: 8
    left:
      enabled: true
      size: 20
      color:
        default: "var(--lcards-gray)"
        active: "var(--lcards-orange)"
    right:
      enabled: false

Annotated Example

A climate thermostat slider with gauge style, tick marks, ranges, 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
    orientation: horizontal
    height: 52
    display:
      min: 15
      max: 30
      unit: "°C"
  gauge:
    color:
      default: "var(--lcards-blue)"
      heat: "var(--lcards-alert-red)"
      cool: "var(--lcards-blue)"
    progress_bar:
      layer: background
      radius: 3
    scale:
      tick_marks:
        major:
          interval: 5
          color: "var(--lcards-moonlight)"
          height: 14
          width: 2
        minor:
          interval: 1
          color: "var(--lcards-gray)"
          height: 7
          width: 1
      labels:
        enabled: true
        show_unit: true
        color: "var(--lcards-moonlight)"
        font_size: 10
    indicator:
      type: triangle
      color: "var(--lcards-orange)"
  ranges:
    - min: 15
      max: 19
      color: "var(--lcards-blue)"
      opacity: 0.25
    - min: 19
      max: 24
      color: "var(--success-color)"
      opacity: 0.25
    - min: 24
      max: 30
      color: "var(--error-color)"
      opacity: 0.25
  border:
    radius: 8
    left:
      enabled: true
      size: 20
      color:
        default: "var(--lcards-gray)"
        active: "var(--lcards-orange)"

tap_action:
  action: more-info