Skip to content
SkillCodex
Menu

Icon button

Icon button

A compact button represented visually by an icon but still given its own stable accessible action name.

Try the component
Context, sources and actions
Sources and revision
Updated
Version
v1.0.26 · r2
Sources
5 sources
Status
Published
Read the sources

You may have searched for: a trash icon I can pressa compact button with no visible textthe copy symbol in a toolbar

All phrasings
Save and share

Recognize

Trigger or navigate

Try it

Does the control trigger an action, change location, or need to remain icon-only?

Icon button

Shared trial context

A project screen lets the user trigger an operation or move to a destination from a control suited to the available space.

Icon button

Mission

Icon button

Reach Copy with Tab, hear its name, activate with Space, then reveal its supplementary tooltip.

pnpm test

Ready

Live result

The code has not been copied yet.

Step 1 of 3

Try

Try the component. Your live result appears just above. Move on at your own pace.

Behavior and edge case
What to observe
The full button target has a visible focus ring, decorative icon, and independent accessible name Copy code.
Edge case
When the icon cannot load, the accessible name and button target remain intact and the action is still understandable to assistive technology.

What this example shows

Icon button performs an action like Button but omits visible text; Link still requires a real navigation destination.

Which fits your need?

Icon button

A familiar action repeats in a dense toolbar

Button

Submitting or resetting a form

Which component will you use here?
Difference and sources

Icon button performs an action like Button but omits visible text; Link still requires a real navigation destination.

Read the sources

    Parts of the specimen

    Select a numbered marker on the schematic, or use the list below, to see its role. The schematic shows the concept's representative state.

    Control

    The interactive element that receives input and exposes state.

    Position in the atlas

    Relationship map

    Locate the chapter, neighboring concepts, and the next useful decision.

    • Chapter

      Trigger or navigate

      Icon button belongs to this comparison group.

    • Do not confuse

      Button

      Choose Icon button if a familiar action repeats in a dense toolbar and space matters more than a visible label. Choose Button if the action is primary or unfamiliar and a visible label prevents misunderstanding.

      Compare this pair
    • Do not confuse

      Link

      Choose Icon button if activation does something in place, such as copy, close, or favorite. Choose Link if activation goes to another page or route, even when only an icon is shown.

      Compare this pair
    • Next step

      Compare the concepts in the chapter before choosing an implementation.

      Open the chapter

    In your own words

    Understand

    What people describe

    Documented aliases: icon-only button, toolbar icon, symbol button

    • a trash icon I can press
    • a compact button with no visible text
    • the copy symbol in a toolbar
    • an icon action with a spoken name
    • a square button for closing
    • a small edit action shown as a pencil

    Choose

    Use it when

    • A familiar action repeats in a dense toolbar
    • A close, copy, or playback action has a well-known symbol

    Avoid it when

    • The icon is ambiguous for the audience
    • There is enough room for a clearer visible text button

    Compare

    Compare similar concepts

    Verification checklist

    Try these actions in the lab, then check the same behaviours in your agent’s result. Adapt the example names to your interface.

    1. 1. Do this

      Reach the icon button with Tab and inspect its accessible name with your browser’s accessibility inspector or a screen reader.

      Expected result

      The name describes the action even when its tooltip is closed.

    2. 2. Do this

      Activate the button once with Enter and once with Space.

      Expected result

      Each key runs the intended action once; focus remains visible around the usable button area.

    3. 3. Do this

      Use the button on a touch screen, including a tap near the edge of its visible control area.

      Expected result

      The usable target extends beyond the tiny icon, neighboring actions are not triggered, and the action is understandable without hover.

    Full contract
    1. 1The button has its own stable accessible name
    2. 2The icon is from the project's single icon family
    3. 3The touch target remains comfortably operable beyond the glyph
    4. 4Tooltip is supplementary and keyboard reachable

    Understand → Recognize → Choose → Compare

    Pack for your agent

    Pre-written instructions to paste into your agent. Copying executes nothing.

    Implement correctly

    Build Icon button without breaking its behavior

    # Implement Icon button in your agent
    
    ## Objective
    Implement Icon button for this verified behavior: A compact button represented visually by an icon but still given its own stable accessible action name.
    
    ## Prerequisites
    - Inspect the repository, design system, and existing tests first.
    - Preserve unrelated changes and keep the file scope bounded.
    - Confirm that Icon button matches the need before writing code.
    
    ## Required behavior
    - Pointer, Enter, or Space activation runs one named action exactly once.
    - Pointer hover or keyboard focus reveals the information after a short delay.
    
    ## States to cover
    - Copy code ready
    - Code copied
    
    ## Accessibility
    - ARIA role: button
    - The primary control or named region for Icon button has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    - The full button target, not only the glyph, receives a visible focus indicator.
    - The button itself does not dismiss; any surface it controls follows that surface's separate contract.
    - A stable aria-label or visually hidden text names the action; Tooltip is never the only accessible name.
    - Tab focuses the icon button
    - Enter and Space activate it
    - Escape dismisses any supplementary tooltip
    
    ## When not to use
    - The icon is ambiguous for the audience
    - There is enough room for a clearer visible text button
    
    ## Acceptance criteria
    - The button has its own stable accessible name
    - The icon is from the project's single icon family
    - The touch target remains comfortably operable beyond the glyph
    - Tooltip is supplementary and keyboard reachable
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The need is tied to canonical behavior before any technical choice.
    • States, accessibility, and non-goals prevent a merely visual implementation.
    • Acceptance criteria and the output format make verification observable.

    Try next

    Verify Icon button on a real journey

    # Verify Icon button after implementation
    
    ## Objective
    Audit the Icon button implementation against its behavior, states, and accessibility requirements without changing it automatically.
    
    ## Checks
    - Replay the smallest representative journey.
    - Check keyboard behavior, focus, accessible name, and announcements.
    - Tie each gap to a specific acceptance criterion.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:6a4e60c8afcdd14b6d0ddd48116015ea5ea837975c9d95d6d7046e83d338e94f

    Diagnose a problem

    Find and fix the Icon button defect

    # Debug Icon button in your agent
    
    ## Observed symptom
    [DESCRIBE THE SYMPTOM HERE]
    
    ## Observable checks
    - Reproduce the issue with the smallest relevant journey.
    - Compare behavior with the documented states and transitions for Icon button.
    - Verify keyboard behavior, focus, accessible name, and announcements.
    
    ## Possible causes
    - The chosen primitive does not match the expected behavior.
    - A state, transition, or focus return is missing.
    - A neighboring component captures an event or hides an accessible signal.
    
    ## Bounded corrections
    - Fix the reproduced cause without recreating neighboring components.
    - Preserve the public contract and add a focused regression test.
    - Do not install dependencies or change remote state without authorization.
    
    ## Final verification
    - The button has its own stable accessible name
    - The icon is from the project's single icon family
    - The touch target remains comfortably operable beyond the glyph
    - Tooltip is supplementary and keyboard reachable
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The explicit symptom prevents starting from an assumed fix.
    • Checks separate behavior, accessibility, and neighboring interference.
    • The fix stays bounded and must produce regression evidence.

    Try next

    Lock in the Icon button fix

    # Prevent the Icon button regression
    
    ## Objective
    Turn the reproduced cause into a focused regression test and compare Icon button with neighboring concepts before widening the fix.
    
    ## Checks
    - Prove that the test fails before the fix.
    - Prove that it passes after the bounded fix.
    - Verify that no neighboring component changed behavior.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:0864c026c15d9f1c9c3aa9f4e231c51f43f2fa246f14797f5706fa0a41ed4f48

    Full entry, saving and provenance

    Pre-written instruction by SkillCodex — your request is neither sent nor used to adapt this text; no content is generated, and copying executes nothing.

    Pack digest: sha256:fa467cbaa1c3bc9ace32d35a69126aaad02e4e9db3ca0c430b16faa975955fa4

    In code

    TechnologyPrimitiveVersionCaveat
    Web platform

    button[type=button] with accessible name

    NativeThe icon may be decorative, but the button needs its own stable accessible name; a tooltip is supplementary only.

    Technical details

    Behaviors

    • Run an action

      Pointer, Enter, or Space activation runs one named action exactly once.

    • Reveal on focus or hover

      Pointer hover or keyboard focus reveals the information after a short delay.

    States

    • Copy code ready

      Copy code ready

    • Code copied

      Code copied

    State transitions

    • Copy code ready → Code copied

      Enter, Space, pointer, or touch activates the named Copy code button.

    • Code copied → Copy code ready

      The transient copied confirmation ends or the replayable specimen is reset.

    Test scenarios

    Context
    A code toolbar includes Copy, Expand, and Close icon buttons with one icon family.
    Mission
    Reach Copy with Tab, hear its name, activate with Space, then reveal its supplementary tooltip.
    Primary state
    The full button target has a visible focus ring, decorative icon, and independent accessible name Copy code.
    Edge case
    When the icon cannot load, the accessible name and button target remain intact and the action is still understandable to assistive technology.

    Visual signals

    • One recognizable icon inside a button target
    • No visible text label
    • Tooltip may supplement but not name the control

    Behavioral signals

    • Uses native button activation semantics
    • Accessible name remains available without Tooltip
    • Touch target is larger than the glyph

    Accessibility

    Role
    button
    Accessible name
    The primary control or named region for Icon button has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    Focus
    The full button target, not only the glyph, receives a visible focus indicator.
    Dismissal
    The button itself does not dismiss; any surface it controls follows that surface's separate contract.
    Scroll
    Activating the control with Space does not scroll the page, and feedback appears without moving focus or causing an unexpected jump.
    Announcement
    A stable aria-label or visually hidden text names the action; Tooltip is never the only accessible name.
    Keyboard
    • Tab focuses the icon button
    • Enter and Space activate it
    • Escape dismisses any supplementary tooltip

    Bindings

    Open the HTML, ARIA, Radix, and shadcn matrix
    • button[type=button] with accessible name

      implementationKind
      native
      nativeElement
      button[type=button] with accessible name
      ariaPattern
      button
      radixPrimitive
      Not applicable
      shadcnRecipe
      Not applicable
      runtimeDependency
      Not applicable
      packageName
      Not applicable
      exportName
      Not applicable
      exactVersion
      Not applicable
      status
      verified
      sourceId
      source-ui-html-button
      deprecationStatus
      active
      replacement
      Not applicable
      validFrom
      Not applicable
      validUntil
      Not applicable

      Equivalence caveat: The icon may be decorative, but the button needs its own stable accessible name; a tooltip is supplementary only.

      Verify binding source

    Sources

    • WHATWG HTML: The button element
      sourceId
      source-ui-html-button
      kind
      standard
      canonicalUrl
      https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element
      publisher
      WHATWG
      sourceRevision
      http-last-modified:2026-07-19T13:52:46Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:418a8f9ce1e8690c6d458121120b0b3b7cd907aa92b2101b85f82f7e02d5ac2f
      status
      verified

      Claim covered: Icon button: normative native semantics, states, attributes, and browser behavior for button.

    • WAI-ARIA APG: Button Pattern
      sourceId
      source-ui-aria-button
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/ARIA/apg/patterns/button/
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-09T07:07:36Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:863329ea659a53439b0953eec0bd0af7c6219e372d0e878f75e57d263924704c
      status
      verified

      Claim covered: Icon button: informative APG guidance for the button pattern: roles, states, relationships, and keyboard interaction.

    • WAI-ARIA APG: Tooltip Pattern
      sourceId
      source-ui-aria-tooltip
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-09T07:07:36Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:28c008aec8fa19be8f285665c3947ac8c9f2604a07d4265c152ffa706cc92461
      status
      verified

      Claim covered: Icon button: informative work-in-progress APG guidance for tooltip role, trigger description, focus retention, pointer continuity, and Escape dismissal.

    • WCAG 2.2: Focus Appearance
      sourceId
      source-ui-wcag-understanding-focus-appearance
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-02T10:07:49Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:fdcf316a1f0e3cc758eda9618322d132862124ff0a3f3b1a3acbf20daf804ff0
      status
      verified

      Claim covered: Icon button: informative WCAG guidance for evaluating visible keyboard focus appearance.

    • WAI-ARIA 1.2: Roles Model
      sourceId
      source-ui-wai-aria-roles
      kind
      standard
      canonicalUrl
      https://www.w3.org/TR/wai-aria-1.2/#roles
      publisher
      W3C WAI
      sourceRevision
      W3C-REC-wai-aria-1.2-20230606
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:c0fea16fc747779569ab754d2d25bca3e2b7e8a673b8ef5362aeb9ebc73a4849
      status
      verified

      Claim covered: Icon button: normative ARIA role definitions and constraints for the stated accessible role.