Skip to content

Add link support to the Icon block #79057

Open

Description

@JelleTempelman

What problem does this address?

The Icon block allows users to insert and style an SVG icon, but it currently does not provide a way to add a link to the icon.

This is limiting in common use cases where icons are used as visual calls to action or navigation elements. For example, in block themes it is possible to add an Icon block inside the Navigation block, but because the icon itself cannot be linked, it cannot easily function as a proper navigation item.

What is your proposed solution?

Add link support to the Icon block.

This could use the standard link UI already used by other core blocks and support common link-related attributes such as url, linkTarget, and rel.

On the front end, when a URL is set, the icon could be wrapped in an element. When no URL is set, the current output should remain unchanged.

Activity

  1. added
    [Type] Enhancement
    on Jun 9, 2026
  2. added
    Needs Decision
    [Block] Icon
    on Jun 9, 2026
  3. added
    [Status] In Progress
    on Jun 10, 2026
  4. t-hamano commented on Jun 14, 2026

    @t-hamano
    Contributor

    While I support adding link support to the Icon block itself, I believe accessibility is the most important thing to consider. The label for the icon is empty by default and is not mandatory to input.

    Image

    Therefore, there is a risk of creating unlabeled links as follows.

    <a href="https://www.google.com/">
      <svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
      </svg>
    </a>

    Therefore, to move forward with this feature, we need to address this issue beforehand.

    One idea I have is to prompt the user to enter a label when a link is applied to an icon.

    Image

    cc @jasmussen @joedolson @afercia

  5. joedolson commented on Jun 14, 2026

    @joedolson
    Contributor

    Honestly, I think that while a warning is helpful, it should actually be mandatory to add link text when linking an icon without text. Setting up a link with no text alternative is a clear and obvious accessibility violation, and since it is entirely possible to provide a mechanism to add that text that has no impact on the visual appearance of the site, we should make it a requirement when adding a link.

    But we should also be clear about how that field is communicated: it's not a label for the icon, it's a label for the link: we need to make sure any text descriptions or help we provide makes it clear that they are providing text for what the link does, not for what the icon looks like.

  6. jasmussen commented on Jun 15, 2026

    @jasmussen
    Contributor

    I do not have a strong opinion on this, and I would certainly defer to Joe and Aki on details.

    In this case I think of icons as content, like text. In that sense I'd focus the use case—which is valid—on the Button instead. Now that we have the Icon block, can we improve the Button block to support icons? I could see new options for icons left/right, or both, and even icon-only in which case we'd need to provide an accessible label. Implementation-wise I'd think something along the lines of Media & Text which includes the Image block, but without surfacing it as an innerblock.

  7. t-hamano commented on Jun 15, 2026

    @t-hamano
    Contributor

    I'd focus the use case—which is valid—on the Button instead. Now that we have the Icon block, can we improve the Button block to support icons?

    Perhaps this could be achieved by adding a new format, inline icons, similar to inline images. See #75715 (comment):

    Inline SVG icon (Inline format)

  8. jasmussen commented on Jun 15, 2026

    @jasmussen
    Contributor

    That's an option, one that would arguably be more flexible than the "built-in" option I'm referring to. Though I'd propose that to be a property of the Icon block, not a new block, if at all possible.

    One of the main reasons for going the other way is that it could be a simpler user experience, kind of like our Storybook for the button: you just toggle on an icon, no need to fiddle with inserting inline blocks.

    I'm also thinking of the existing implementation of the navigation block, where the iconography for the burger itself, a property.

    Image

    Perhaps both paths can lead to the same destination!

  9. joedolson commented on Jun 16, 2026

    @joedolson
    Contributor

    It seems reasonable to consider the use of icons as an extension of the button block, although I suspect that users will want to add icons in other cases, as well. But as a starting point to support, that's pretty reasonable.

    It doesn't change anything about the need to require link text, however.

  10. Jiwoon-Kim commented on Aug 6, 2026

    @Jiwoon-Kim
    Contributor

    Personally, I am somewhat skeptical about the value of the Icon block itself, and therefore also about adding link support to it.

    An icon is not usually a meaningful component or interaction on its own. Its meaning comes from the component and context around it: a button, navigation item, status indicator, disclosure control, or other named interaction.

    I think the larger architectural value is the icon registry rather than the Icon block. The important capability is allowing a semantic component to request an icon through a stable identifier, while themes provide the visual implementation.

    That would let a theme replace an SVG while preserving the component's markup, behaviour, accessibility, responsive states, and interaction model.

    Some examples from my own design-system work:

    At the moment, core blocks often output SVG controls directly. To adapt them to a design system, a theme may need to hide a particular SVG and recreate it with CSS or an icon font. This is fragile, especially for Navigation submenus, responsive-menu controls, and Image lightbox controls, because the theme ends up depending on internal markup or even SVG path data.

    A registry-backed approach would be more valuable if core components could consume semantic icon identifiers themselves. For example, a Navigation submenu could request an expand-more or submenu icon from the registry rather than directly embedding an SVG. A theme could then supply its own Material SVG while preserving all of core's existing interaction behaviour.

    For navigation-item icons specifically, I recently implemented a companion plugin that may be useful as a reference:

    The plugin adds icons to Navigation items because core Navigation currently has no general item-icon slot. I would welcome a core-level extension point for that use case as well.

    I hope this discussion can consider the icon registry as shared infrastructure for core components, themes, and plugins, rather than treating it only as a source for a standalone Icon block.

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

    Needs Decision[Block] Icon[Status] In Progress[Type] Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions