Skip to content

Conversation

karwosts
Copy link
Member

@karwosts karwosts commented Aug 10, 2025

Proposed change

We provide the getConfigForm function in frontend for custom cards to develop a visual editor, but I don't think it's currently documented.

Not a super detailed description of every possible option, but hopefully better than nothing.

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

Summary by CodeRabbit

  • Documentation
    • Added a guide for the built-in form editor for custom cards: details the config form schema, selector fields (entity/icon/attribute), customizable field labels and helper text, theme and state options, and validation behavior that can enable/disable the visual editor. Includes a screenshot. Documentation-only change; no runtime or API impact.

@karwosts karwosts marked this pull request as ready for review August 10, 2025 22:40
Copy link
Contributor

coderabbitai bot commented Aug 10, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Documents a new "Using the built-in form editor" section in docs/frontend/custom-ui/custom-card.md describing static getConfigForm() returning an object with up to four keys (schema, computeLabel, computeHelper, assertConfig), example schema, behavior notes, and a screenshot; documentation-only, no code/API changes.

Changes

Cohort / File(s) Change Summary
Custom Card Documentation Update
docs/frontend/custom-ui/custom-card.md
Added "Using the built-in form editor" section describing static getConfigForm() return object (schema, computeLabel, computeHelper, assertConfig), included example form schema (fields: label, entity, grid with name, icon, attribute, unit, theme, state_color), explained computeLabel/computeHelper/assertConfig semantics and editor re-enable behavior, and added a screenshot. Documentation-only; no exported/public API changes.

Sequence Diagram(s)

Not applicable — documentation-only change.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge Base: Disabled due to data retention organization setting

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c62adfc and 1b76e6b.

📒 Files selected for processing (1)
  • docs/frontend/custom-ui/custom-card.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/frontend/custom-ui/custom-card.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Redirect rules - developers-home-assistant
  • GitHub Check: Header rules - developers-home-assistant
  • GitHub Check: Pages changed - developers-home-assistant
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch karwosts-patch-2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
docs/frontend/custom-ui/custom-card.md (4)

323-324: Use “built-in” and tighten sentence grammar

Hyphenate “built-in” and remove the superfluous comma for clarity.

-### Using the builtin form editor
-While one way to configure a graphical editor is to supply a custom editor element, another option for cards with relatively simple configuration requirements is to use the builtin frontend form editor. This is done by defining a static `getConfigForm` function in your card class, that returns a form schema, defining the shape of your configuration form. 
+### Using the built-in form editor
+While one way to configure a graphical editor is to supply a custom editor element, another option for cards with relatively simple configuration requirements is to use the built-in frontend form editor. This is done by defining a static `getConfigForm` function in your card class that returns a form schema defining the shape of your configuration form.

334-360: Remove unused empty “name” from grid schema

The grid container doesn’t need a name; keeping it empty is noise.

         {
           type: "grid",
-          name: "",
           schema: [

381-386: Add a note encouraging localization of labels and helpers

Encourage authors to localize text instead of hardcoding strings.

 - `computeLabel`: This function will be called per form field, allowing the card to define the label that will be displayed for the field. If `undefined`, Home Assistant may apply a known translation for generic field names like `entity`, or you can supply your own translations.
 - `computeHelper`: This function will be called per form field, allowing you to define longer helper text for the field, which will be displayed below the field. 
+
+Tip: Prefer localized strings for labels and helper text instead of hardcoded values to support multiple languages.

381-384: Optional: Link to selector documentation for deeper reference

A link helps readers discover available selectors and options.

-- `schema`: This is a list of schema objects, one per form field, defining various properties of the field, like the name and selector.
+- `schema`: This is a list of schema objects, one per form field, defining various properties of the field, like the name and selector. See the selector reference for available selector types and options.
+
+Reference: https://developers.home-assistant.io/docs/blueprint/selectors/

Please verify the correct canonical link for selector documentation in this repo structure.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 577e0dd and c9e9558.

⛔ Files ignored due to path filters (1)
  • static/img/en/frontend/dashboard-custom-card-config-form.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • docs/frontend/custom-ui/custom-card.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
docs/frontend/custom-ui/custom-card.md

[grammar] ~323-~323: Ensure spelling is correct
Context: ...tend card editor }); ``` ### Using the builtin form editor While one way to configure ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~324-~324: Ensure spelling is correct
Context: ...onfiguration requirements is to use the builtin frontend form editor. This is done by d...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

@frenck frenck requested a review from Copilot September 1, 2025 13:02
Copy link
Contributor

@Copilot 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

This PR adds documentation for the getConfigForm function, which allows custom card developers to create visual configuration editors using Home Assistant's built-in form system rather than implementing custom editor elements.

  • Documents the getConfigForm static method and its return object structure
  • Provides a comprehensive example showing schema definition, selectors, and callback functions
  • Explains how the visual editor can be conditionally enabled/disabled based on configuration validation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

Thanks, @karwosts 👍

./Frenck

@frenck frenck merged commit c655a78 into master Sep 1, 2025
5 checks passed
@frenck frenck deleted the karwosts-patch-2 branch September 1, 2025 13:12
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