--- url: "https://web.dev/articles/building/a-split-button-component" titulek: "Building a split-button component | Articles | web.dev" h1: "Building a split-button component Stay organized with collections Save and categorize content based on your preferences." popis: "A foundational overview of how to build an accessible split-button component." jazyk: "en" kanonicka: "https://web.dev/articles/building/a-split-button-component" drobecky: ["Articles", "Building a split-button component"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 02:40:46" znaku: 17391 slov: 2704 kodovani: "iso-8859-2" sha256: "5c2340e32fba4e247004b942e753d4017d9afacec17aefb02a98f527c841a492" --- Building a split-button component Stay organized with collections Save and categorize content based on your preferences. A foundational overview of how to build an accessible split-button component. Adam Argyle In this post I want to share thinking on a way to build a split button . [Try the demo](https://gui-challenges.web.app/split-buttons/dist/). [Demo](https://gui-challenges.web.app/split-buttons/dist/) If you prefer video, here's a YouTube version of this post: Overview [Split buttons](https://www.nngroup.com/articles/split-buttons/) are buttons that conceal a primary button and a list of additional buttons. They're useful for exposing a common action while nesting secondary, less frequently used actions until needed. A split button can be crucial to helping a busy design feel minimal. An advanced split button may even remember the last user action and promote it into the primary position. A common split button can be found in your email application. The primary action is send, but perhaps you can send later or save a draft instead: The shared action area is nice, since the user doesn't need to look around. They know that essential email actions are contained in the split button. Parts Let's break down the essential parts of a split button before discussing their overall orchestration and final user experience. [VisBug](https://github.com/GoogleChromeLabs/ProjectVisBug)'s accessibility inspect tool is used here to help show a macro view of the component, surfacing aspects of the HTML, style and accessibility for each major part. Top level split button container The highest level component is an inline flexbox, with a class of `gui-split-button`, containing the primary action and the `.gui-popup-button`. The primary action button The initially visible and focusable ` ` Notice the aria attributes `aria-haspopup` and `aria-expanded`. These cues are critical for screen readers to be aware of the capability and state of split button experience. The `title` attribute is helpful for everyone. Add an `` icon and the `.gui-popup` container element. `
` For straightforward popup placement, `.gui-popup` is a child to the button that expands it. The only catch with this strategy is the `.gui-split-button` container can't use `overflow: hidden`, as it will clip the popup from being visually present. A `