Skip to content

Document the visibility schema kwarg + cascade rule for visual editors#141

Draft
bdraco wants to merge 3 commits intomainfrom
config-var-ui-hints
Draft

Document the visibility schema kwarg + cascade rule for visual editors#141
bdraco wants to merge 3 commits intomainfrom
config-var-ui-hints

Conversation

@bdraco
Copy link
Copy Markdown
Member

@bdraco bdraco commented May 6, 2026

What does this implement/fix?

Documents the new cv.Visibility StrEnum and visibility=
kwarg on cv.Optional / cv.Required introduced in
esphome/esphome#16267.

The kwarg is a UI hint consumed by schema-driven editors (the
device-builder dashboard catalog, third-party tools); it doesn't
affect YAML validation. This PR adds a #### Schema-driven UI hints (visibility) subsection under the existing "Configuration
Schema" / public-Python-API section in
docs/contributing/code.md covering:

  • The three values (unset / ADVANCED / YAML_ONLY) and when
    to reach for each.
  • The single-axis strictness ordering (YAML_ONLY > ADVANCED

    unset) — encoded in the type so contradictory states can't
    be expressed.

  • Real-world examples (setup_priority
    Visibility.YAML_ONLY, time-platform update_interval
    Visibility.ADVANCED).
  • The helper-kwarg pattern for schemas that wrap a cv.Optional
    inside a function call (e.g. polling_component_schema's new
    visibility= parameter).
  • A new ##### Cascading subsection explaining the consumer-side
    rule: a stricter parent forces every descendant at-least as
    strict. The schema marker stays per-field as the author wrote
    it; the cascade is computed by consumers when they walk the
    tree.
  • A note that adding visibility isn't a YAML-side breaking
    change but does need coordination with catalog consumers when
    flipping a previously-shown field to Visibility.YAML_ONLY.

Related issue or feature (if applicable):

Pairs with esphome/esphome#16267 which adds the kwargs to
cv.Optional / cv.Required. Adds a new subsection under
'Configuration Schema' explaining the semantics, when to use
each flag, and the helper-kwarg pattern for shared schemas
like polling_component_schema.
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for esphome-dev-docs ready!

Name Link
🔨 Latest commit cc295a0
🔍 Latest deploy log https://app.netlify.com/projects/esphome-dev-docs/deploys/69fabd88bcd28b000861bc8e
😎 Deploy Preview https://deploy-preview-141--esphome-dev-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@bdraco bdraco changed the title Document advanced / yaml_only schema kwargs for visual editors Document the visibility schema kwarg + cascade rule for visual editors May 6, 2026
@bdraco bdraco requested a review from Copilot May 6, 2026 03:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents the new schema-driven UI hint mechanism (cv.Visibility and the visibility= kwarg on cv.Optional/cv.Required) for downstream visual editors, including how consumers should compute effective visibility via cascading.

Changes:

  • Added a new “Schema-driven UI hints (visibility)" subsection under the public Python API / Configuration Schema docs.
  • Documented the three visibility levels, intended usage guidance, and strictness ordering.
  • Documented the consumer-side cascading rule and coordination considerations when changing visibility on existing fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/contributing/code.md Outdated
Comment thread docs/contributing/code.md Outdated
Comment thread docs/contributing/code.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants