Skip to content

Show or hide a layout block by a field's value, not only when it's empty #720

Closed

Description

@M4n0x

Problem

A layout block can hide only when a field is empty (hideWhenEmpty). It can't follow what a field says, such as a calendar widget's phase (later, soon, now, live):

  • On the bar, a meeting widget can't show the start time while the meeting is later, "in 8 min" before it starts and "8 min left" while it runs, or a dot in place of the calendar symbol while it's live.
  • In a popup, it can't show "Starts in 8 min" or "Live · 8 min left", or a Calendar access button only when fields.access isn't granted.
  • A list row can't change with one of its fields, such as fading the events that have ended.
  • A provider widget can't hide when the calendar has no meetings (phase is none) and still show No calendar access: hideWhenEmpty: "title" hides both.

Proposal

showWhen and hideWhen on any layout block: a widget's layout, hoverLayout and overlay, popups and list rows.

  • Each takes a condition as a rule's when does, { "field": "phase", "equals": "live" } or { "value": "remaining", "below": 0.2 }, or a list of them, any of which matches.
  • showWhen shows the block only while it matches; hideWhen hides it while it matches.
  • In a list row, fields come from the row, as for hideWhenEmpty.
  • A hidden block takes no space, like one hidden by hideWhenEmpty, and a script or provider widget whose blocks are all hidden is hidden (A widget with no visible output yet shows an empty pill, or only a red dot when its script fails #379).
{ "type": "symbol", "name": "calendar", "hideWhen": { "field": "phase", "equals": "live" } },
{ "type": "symbol", "name": "circle.fill", "showWhen": { "field": "phase", "equals": "live" } },
{
  "type": "row",
  "showWhen": [{ "field": "phase", "equals": "soon" }, { "field": "phase", "equals": "now" }],
  "children": [{ "type": "text", "text": "in" }, { "type": "field", "field": "minutes" }, { "type": "text", "text": "min" }]
}

The keys are new, so existing configurations don't change.

Possible today

Partly, and only on the bar: rules set a data state from phase, and a block's style.states.<state> with width: 0 and opacity: 0 hides it. A row's spacing still shows around the hidden block, popups don't take data states (docs/styling.md, Presentation roles), and list rows have none.

Related

Triaged by Claude Code (Claude Opus 5.5).

Activity

  1. added
    enhancement
    on Nov 16, 2026
  2. added a commit that references this issue on Nov 17, 2026
    b455b2f
  3. stablebar-releases commented on Nov 20, 2026

    @stablebar-releases

    🎉 This issue has been resolved in version 0.18.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementreleased

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions