Dashboards

Home Assistant Grid Card and ApexCharts Card Guide

Home Assistant grid card and ApexCharts card guide: built-in grid YAML, avoiding layout gaps, installing ApexCharts via HACS and chart examples.

On this page
  1. Quick answer
  2. Grid card basics
  3. When the grid isn’t enough
  4. Install ApexCharts Card
  5. A first ApexCharts card
  6. Grouping data and time windows
  7. Troubleshooting

Quick answer

The grid card is built into Home Assistant. It arranges cards in equal columns. The ApexCharts card is a community card, installed through HACS, that draws line, bar, area and other charts from your sensors. The two work well together: place ApexCharts cards inside a grid to build a dashboard with live values and history graphs.

Grid card basics

Set the card type to grid, add your cards under cards, and choose a column count:

type: grid
title: Living Room Controls
columns: 2
square: false
cards:
  - type: button
    entity: light.living_room
  - type: button
    entity: media_player.living_room_tv

The main options are:

  • columns: the number of columns per row. The default is 3.
  • square: makes each item square. It’s on by default, so set it to false for cards that need flexible heights.
  • title: a heading above the grid.

You can nest a grid inside another grid to build more complex layouts. The grid always uses equal columns, whatever the screen width. For a phone and a desktop with different layouts, use visibility conditions to show different cards on each.

When the grid isn’t enough

If you need CSS-style grid areas, explicit row sizing or responsive breakpoints, the third-party layout-card (custom:layout-card) offers more control. Its syntax takes some learning, so start with a simple layout.

A common problem with grids is blank gaps under shorter cards. A forum user ran into this, and the fix other members suggested is one vertical stack per column. Each column then holds its cards in order, so the layout packs without holes. It’s also quicker to maintain than a long list of grid areas.

Install ApexCharts Card

  1. Open HACS and search for ApexCharts Card, then install it. HACS normally registers the frontend resource for you.
  2. Reload the browser, or restart the frontend, so the card loads.
  3. Add a card and set its type to custom:apexcharts-card.

Check the Dashboards Resources page before you add a resource by hand. Community members report startup problems when a manual resource entry duplicates the one HACS created.

A first ApexCharts card

This example shows the living room temperature over the last 24 hours:

type: custom:apexcharts-card
header:
  title: Living room temperature
graph_span: 24h
series:
  - entity: sensor.living_room_temperature
    name: Living room

Replace the entity ID with your own sensor. You can add more series to compare sensors on one chart. Each series can use its own axis.

Grouping data and time windows

To smooth a long history, group the data and choose an average. This example shows daily averages across a week:

type: custom:apexcharts-card
header:
  title: Daily average
graph_span: 7d
series:
  - entity: sensor.living_room_temperature
    name: Living room
    group_by:
      duration: 1d
      func: avg

The graph_span option sets the time window, such as 24h or 7d. The group_by option sets how long each bucket is and how values combine. Common functions include average, minimum, maximum and sum. The card also supports chart types such as line, area and bar, and custom data sources for values that aren’t entities.

Sizing differs across layouts. Check the card’s documentation for the current height option, and test the chart in the layout you’ll use.

Troubleshooting

  • “Custom element doesn’t exist” or a similar error. Confirm the card is installed in HACS and that the resource is loaded. Clear the browser cache, then reload. Some users fix the type error by wrapping it in single quotes: type: 'custom:apexcharts-card'.
  • The graph is empty. Check that the sensor has recorded history. The recorder keeps data for 10 days by default, so a graph_span longer than that won’t show older values unless you change the recorder settings.
  • Cards leave gaps in the grid. Use one vertical stack per column, as described above.

For the bigger picture of dashboards, see the Home Assistant dashboards guide. If you want a wall display, the wall-mounted touchscreen guide shows which layouts suit a fixed screen. Themes change colours but not card positions, so see the themes guide for styling.

The complete guide to dashboards

Home Assistant Dashboards: Building a Beautiful Lovelace UI
Read the guide

Keep exploring

Guides from other topics

All topics →