Skip to main

Design System

  • Welcome
  • Colors
  • Typography
  • Spacing

CSS

  • Utilities
  • Compositions

Component Library

  • Aside
  • Audio Player
  • Authors
  • Banners
  • Block quotes
  • Brand
  • Breadcrumbs
  • Browser compatibility table
  • Button
  • Callout
  • Cards
  • Carousel
  • Code blocks
  • Compare
  • Counter
  • Details
  • Ellipsis
  • Eyebrow
  • Floating Action Button
  • Feature Card
  • Figure
  • Fixed width Image
  • Form Fields
  • Headline
  • Hero
  • Hero Image
  • Icon Button
  • Indicator
  • Labels
  • Lists
  • Numbered headers
  • Page Header
  • Pagination
  • Pill
  • Preview Pagination
  • Prose
  • Spinner
  • Stack Nav
  • Stats
  • Status List
  • Tables
  • Tabs
  • Generated table of contents
  • Toggle Switch
  • Tooltips

Icon Button - Component

With Tooltip
View full screen
Code

Source (Nunjucks)

{% if data.tooltip %}
<button class="icon-button tooltip" aria-labelledby="icon-button-toolip">
{% include "icons/close.svg" %}
<span class="tooltip__content" id="icon-button-toolip">{{ data.tooltip }}</span>
</button>
{% else %}

<button class="icon-button" aria-label="{{ data.label }}">
{% include "icons/close.svg" %}
</button>
{% endif %}

Output

<button class="icon-button" aria-label="Close">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height="24"
width="24"
>

<path d="M0 0h24v24H0z" fill="none" />
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
/>

</svg>
</button>

Information

You have two choices when using this pattern. Use it in connection with the tooltip or set an aria-label on the <button class="icon-button"> element.

Key links

  • Sass File

Variants

With Tooltip

View full screen
Code

Source (Nunjucks)

{% if data.tooltip %}
<button class="icon-button tooltip" aria-labelledby="icon-button-toolip">
{% include "icons/close.svg" %}
<span class="tooltip__content" id="icon-button-toolip">{{ data.tooltip }}</span>
</button>
{% else %}

<button class="icon-button" aria-label="{{ data.label }}">
{% include "icons/close.svg" %}
</button>
{% endif %}

Output

<button class="icon-button tooltip" aria-labelledby="icon-button-toolip">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height="24"
width="24"
>

<path d="M0 0h24v24H0z" fill="none" />
<path
d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
/>

</svg>
<span class="tooltip__content" id="icon-button-toolip">Close</span>
</button>

We want to help you build beautiful, accessible, fast, and secure websites that work cross-browser, and for all of your users. This site is our home for content to help you on that journey, written by members of the Chrome team, and external experts.

Contribute

  • File a bug
  • View source

Related content

  • developer.chrome.com
  • Chrome updates
  • Case studies
  • Podcasts
  • Shows

Connect

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms & Privacy
  • Community Guidelines

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.