Polygon¶
A Polygon is a multi-sided shape such as a triangle, square, pentagon, or hexagon. It can be used as a background, badge, indicator, frame, or as a matching shape behind another card element.
This page shows how to choose the number of sides, size and orient the Polygon, round its corners, style it, and use it together with a Horseshoe.
Add a Polygon¶
A Polygon creates a triangle, hexagon, or another multi-sided shape. width and height can be set independently, so the shape can also be stretched horizontally or vertically.
Choose the number of sides¶
Change sides to create another regular shape:
3— triangle4— quadrilateral6— hexagon- higher values — more sides
Change the size and corners¶
Use width and height to size the Polygon. Use radius to round its corners; 0 keeps them sharp.
Choose what faces upward¶
top selects which point on the Polygon faces the top of the card.
For example:
top: 0places corner0at the top;top: 0.5places the middle of the first side at the top;- decimal values choose a position along a side.
Use top to choose whether a point or a flat side faces upward.
For a triangle and hexagon:
Fill the Polygon or show only the border¶
Use styles to control the fill, border (stroke), border width, opacity, and other appearance.
A thick or partly transparent border can look darker where the fill continues underneath it. fill_mask prevents that visual overlap by stopping the fill farther inward.
Prevent the fill and border from visually overlapping¶
When a Polygon has both a fill and a border, part of the border lies inside the Polygon. If the fill continues underneath that part, opacity can make the border look darker or heavier than intended.
The default fill_mask: auto stops the fill at the inside edge of the border. You normally leave it unchanged. Set a larger value only when you deliberately want the fill to stop farther inward and create extra visible space. 0 allows the fill to continue underneath the border; negative values are not supported.
Use the same shape for a Horseshoe path¶
A Horseshoe can use a polygon-shaped path. See Horseshoe path shapes.
Change color or behavior with an entity¶
Add entity_index when the Polygon should use an entity for color, visibility, actions, or other supported behavior. See Color stops and Interaction.
Configuration options¶
Required applies to the specific form described by that table: Yes means you need the field for that form; No means you can leave it out. Not set means the card adds no explicit value when the option is omitted.
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
xpos | number | Yes | — | Horizontal center position. |
ypos | number | Yes | — | Vertical center position. |
sides | integer | Yes | — | Number of sides; must be 3 or greater. |
width | number | Yes | — | Outer width. |
height | number | Yes | — | Outer height. |
radius | number | No | 0 | Corner radius. |
top | number | No | 0 odd sides / 0.5 even sides | Chooses which corner or side faces upward; the default keeps odd and even polygons visually upright. |
fill_mask | auto / number ≥ 0 | No | auto | Controls where the fill ends relative to the border. 0 lets it continue underneath the border; auto stops it at the inside edge; larger values move it farther inward. |
entity_index | entity index | No | Not set | Entity used for value-dependent appearance and behavior. |
styles | mapping | No | Default polygon style | Sets the fill, border (stroke), border width, opacity, and other visible Polygon styling. |
color_stops | mapping | No | Not set | Colors the polygon based on an entity value. |