Dropdown List Badge Copilot Rules — CoPilot Rules
    Neura Market
    Neura Market
    /CoPilot
    Marketplace
    Directories
    Resources
    CoPilot
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeekCoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    OverviewRulesPromptsMCPsAgentsGamesBlogVideosGuidesCoursesCommunityPluginsTrending
    CoPilotRulesDropdown List Badge Copilot Rules
    Back to Rules

    Dropdown List Badge Copilot Rules

    evandepol July 19, 2026
    0 copies 0 downloads
    Rule Content
    # Copilot Instructions for dropdown-list-badge
    
    ## Project Overview
    - Home Assistant Lovelace custom badge for selecting and displaying `input_select` entity values via a dropdown.
    - Designed for user-specific UI, accessibility, and robust integration with Home Assistant and HACS.
    
    ## Architecture & Key Components
    - Main source: `dropdown-list-badge.ts` (TypeScript)
      - Contains badge and editor components.
      - Registers custom elements globally via `globalThis.customCards` for Home Assistant discovery.
    - Build output: `dist/dropdown-list-badge.js` (bundled via esbuild, IIFE format).
    - Editor UI: Renders in shadow DOM, preserves focus/caret, supports live config changes.
    - Versioning: Injected from `version.json` at build time.
    
    ## Developer Workflows
    - **Build:**
      - `npm run build` (type-checks with `tsc --noEmit`, bundles with `esbuild`).
      - Version injected via `prebuild` script using `jq` and `sed`.
    - **Test:**
      - `./run-test.sh` builds, serves, and runs Playwright tests in Docker/Colima.
      - Visual regression snapshots and HTML reports in `tests/` and `tests/html-report/`.
    - **Environment:**
      - Use `./start-docker-env.sh` and `./stop-docker-env.sh` to manage Colima/Docker and required tools (e.g., `jq`).
    - **CI/CD:**
      - GitHub Actions workflow (`validate.yaml`) uses Docker layer caching, builds/tests in a single job, and extracts/uploads artifacts from the built image.
      - Dist updates are committed via PR from `update-dist-artifact` branch.
    
    ## Project-Specific Patterns & Conventions
    - **Custom Element Registration:**
      - Register via `globalThis.customCards` for Home Assistant compatibility.
    - **TypeScript Exports:**
      - Export classes for Playwright tests, but bundle as IIFE for Home Assistant (no top-level exports in final JS).
    - **User-Specific UI:**
      - Use per-user `input_select` helpers and Home Assistant’s conditional visibility for personalized dashboards.
    - **Error Handling:**
      - Defensive guards in `_render()` and dropdown logic to avoid undefined `hass`/`states` errors.
    - **Build Output:**
      - Only the bundled JS in `dist/` is used by Home Assistant/HACS; source TS is for development/testing only.
    
    ## Integration Points
    - **Home Assistant:**
      - Badge loaded as Lovelace resource (via HACS, e.g., `/hacsfiles/dropdown-list-badge/dist/dropdown-list-badge.js`).
    - **HACS:**
      - `hacs.json` must specify correct filename and `content_in_root: false` for proper deployment.
    - **Playwright:**
      - UI and visual regression tests in `tests/badge.spec.ts`.
    - **Colima/Docker:**
      - All dev/test tools run in containers; no global install required.
    
    ## Examples & References
    - See `dropdown-list-badge.ts` for custom element registration and defensive rendering.
    - See `run-test.sh` and `start-docker-env.sh` for local dev/test orchestration.
    - See `README.md` for concise configuration and user-specific UI patterns.
    - See `.github/workflows/validate.yaml` for CI/CD, Docker caching, and artifact handling.
    
    ---
    **For AI agents:**
    - Always reference the bundled JS in `dist/` for Home Assistant/HACS integration.
    - Use Colima/Docker scripts for local dev/test; avoid global installs.
    - Follow defensive rendering and registration patterns in `dropdown-list-badge.ts`.
    - When updating workflows, preserve Docker caching and artifact extraction steps.
    

    Comments

    More Rules

    View all

    QPrisma Copilot Rules

    A
    alexandergg

    Site Casanova Limaemedeiros Copilot Rules

    V
    victormedeeeiros-design

    Mosl Custom Chart Copilot Rules

    R
    riviangeralt

    InOut App Copilot Rules

    J
    jeanvq

    Fastfood Express Copilot Rules

    J
    jersonjjcr

    Pds Pre View Copilot Rules

    E
    eiriksgata

    Neura weekly digest

    Stay up to date

    The week's most-read AI news, trending AI tools and new automation workflows, in one email. At most once a week. Free, and you can unsubscribe in one click.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for CoPilot and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Games
    • Blog
    • Videos
    • Guides
    • Courses
    • Community
    • Plugins

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.

    Neura Market

    Custom AI Systems & Services

    Our team of experienced AI builders will help build custom AI systems, workflows, and solutions.

    Request custom work

    Ready-made automations for this

    Workflows from the Neura Market marketplace related to this CoPilot resource

    • Automated Execution Cleanup System with n8n API and Custom Retention Rulesn8n · $9.99 · Related topic
    • Receive and Analyze Emails with Rules in Sublime Securityn8n · $9.99 · Related topic
    • SharePoint List Fetch with OAuth Tokenn8n · $4.99 · Related topic
    • Create an IPL Cricket Rules Q&A Chatbot with Google Gemini APIn8n · $14.99 · Related topic
    Browse all workflows