Anniversary Sale · up to 80% off all librariesEnds Nov 9Shop now
SOFTTDocs
Features
You are reading the documentation for ESP-DASH v4.x.x, which is no longer the latest release. View the v5.x.x documentation.

Widget Size

Set the responsive width of ESP-DASH Pro v4 cards and charts per screen breakpoint with setSize().

ESP-DASH Pro feature. This functionality is available only in the commercial edition of ESP-DASH.

setSize() sets the responsive width of a card or chart. You define a width for each screen breakpoint, and the dashboard layout adapts to the screen size without changes to the webpage.

Widgets with custom sizes

Breakpoints

Each breakpoint accepts a value from 1 to 12.

Prop

Type

Methods

setSize() has two overloads, declared in Card.h of ESP-DASH Pro.

setSize(xs, sm, md, lg, xl, xxl)

Pass each breakpoint as a separate argument:

void setSize(const uint8_t xs, const uint8_t sm, const uint8_t md, const uint8_t lg, const uint8_t xl, const uint8_t xxl);
card1.setSize(12, 12, 6, 4, 3, 2);

setSize(const CardSize &size)

Pass a CardSize structure:

struct CardSize {
  uint8_t xs;
  uint8_t sm;
  uint8_t md;
  uint8_t lg;
  uint8_t xl;
  uint8_t xxl;
};

void setSize(const CardSize &size);
card1.setSize({
  .xs = 12,
  .sm = 12,
  .md = 6,
  .lg = 4,
  .xl = 3,
  .xxl = 2
});

On this page