Pill Button
Rounded buttons perfect for filters, tags, and selection interfaces.
Ready to use
Pill Buttons are secondary interactive elements used for filtering, tagging, or toggling options within the interface. They are visually lighter than standard buttons and should never be used for primary actions. Two main use cases sit under the same shell: selectable pills that represent filters or toggles, and informational pills that highlight contextual labels or statuses.
Anatomy
Section titled “Anatomy”- Container
- Label
- Leading icon
- Trailing icon
When to use it
Section titled “When to use it”Use a Pill Button when:
- You need lightweight, secondary interactions like filters or tag selectors.
- You want to group related options horizontally (e.g. category filters).
- A clear selected / unselected visual state is part of the pattern.
Avoid the Pill Button when:
- The action represents a primary call to action — use Primary Button instead.
- The action leads to navigation — use a Link Button.
- You need destructive or confirmatory actions — use Secondary or Alert Buttons.
Properties
Section titled “Properties”Type
Four colour treatments — Neutral, Contrast, OnOverlay Light, and OnOverlay C2A — each tuned to a different surface. Use Neutral on standard light backgrounds, Contrast on dark, and the OnOverlay variants when the pill sits over imagery or video.
State
Rested, Hover, Active (selected), Disabled, and Focus. Active carries the selected visual; disabled keeps the shape but mutes the colour; focus shows a 2 px outline so the control stays reachable from the keyboard.
Size
Three text sizes — Large for prominent filter areas, Medium as the default, Small for dense layouts. The pill always hugs its label and keeps the rounded shape regardless of size.
Icon
Optional leading and trailing icons. Pair them with the label only when they add meaning (a chevron for a dropdown trigger, a spinner during loading); icon-only pills aren’t supported.
Platform considerations
Section titled “Platform considerations”Desktop
Pointer accuracy is high, but keep at least 8 px between adjacent pills so the hit areas don’t crowd each other in dense filter rows.
Tablet
Mix of touch and pointer — the medium size handles both. Keep the 44 px touch area honoured even when the visual height drops below it (use invisible padding).
Mobile
Touch-first. Stick to medium or large pills wherever possible and pay close attention to spacing so users don’t tap the wrong filter.
Best practices
Section titled “Best practices”Keep pills lightweight and visually distinct from primary actions.
Do
Add invisible padding around pills when needed to expand the touch target without altering the visual, keep at least 8 px horizontally and 4 px vertically between adjacent pills, and make sure each pill carries visible text and a clearly distinguishable focus state.
Don't
Don’t rely on the visible shape alone to define the touch area, don’t define touch areas smaller than 24×24 px even for compact pills, and don’t place pills close enough that their touch areas overlap.
Content guidelines
Section titled “Content guidelines”Pill labels must clearly describe what they do or what they represent. Keep filter labels to 1–2 words (“Electric”, “In stock”) and action labels to 1–3 (“Apply”, “Show all”). Use clear, specific text that stands on its own — users shouldn’t need to read nearby copy to understand a pill — and avoid vague labels like “OK”, “Click”, or “Select”. Stay under 24–30 characters to keep translations and responsive layouts well-behaved, use sentence case (“Apply filter”, not “APPLY FILTER”), and skip trailing punctuation. Use neutral, easily localisable phrasing — avoid idioms or culture-specific references. Never truncate; wrap to a new line if the label needs more room.
Styles
Section titled “Styles”Rounded buttons perfect for filters, tags, and selection interfaces.
The default size is lg.
<button class="tng-pill-button is-sm">Small</button><button class="tng-pill-button is-md">Medium</button><button class="tng-pill-button is-lg">Large</button>States
Section titled “States”<button class="tng-pill-button is-selected">Selected</button><button class="tng-pill-button" disabled>Disabled</button>On overlay
Section titled “On overlay”<button class="tng-pill-button on-overlay">Rested</button><button class="tng-pill-button on-overlay is-selected"> Selected</button><button class="tng-pill-button on-overlay" disabled>Disabled</button><button class="tng-pill-button on-overlay is-cta">Rested</button><button class="tng-pill-button on-overlay is-cta is-selected"> Selected</button><button class="tng-pill-button on-overlay is-cta" disabled> Disabled</button><button class="tng-pill-button"> <i class="tng-icon icon-ui-spinner" aria-hidden="true"></i> <span>Loading</span></button><button class="tng-pill-button"> <span>Popular</span> <i class="tng-icon icon-arrow-right" aria-hidden="true"></i></button>Description
Section titled “Description”The PillButton component renders a button with a pill-shaped design.
Pill buttons are secondary interactive elements used for filtering, tagging, or toggling options whitin the interface. They are visually lighter than standard buttons and should never be used for primary actions.
There are two main use cases:
- Selectable Pills: used to represent filters or toggles that can be selected/deselected.
- Informational Pills: used to highlight contextual information (e.g. labels or statuses).
Component
Section titled “Component”Properties
Section titled “Properties”PillButtonProperties extends <React.HTMLAttributes<HTMLButtonElement>> which means it includes all standard HTML attributes that can be applied to a button element.
| Prop | Type | Description | Optional |
|---|---|---|---|
text | string | The text label displayed inside the pill button | ❌ |
className | ClassValue | Custom class names applied to the button element | ✅ |
buttonSize | 'sm' | 'md' | 'lg' | Defines the size of the button | ✅ |
isHighlight | boolean | Indicates if the button should appear highlighted | ✅ |
isSelected | boolean | Indicates if the button is currently selected | ✅ |
isCta | boolean | Marks the button as a Call-To-Action (CTA) | ✅ |
onOverlay | boolean | Indicates if the button is displayed on an overlay | ✅ |
leadingIcon | ToyotaIcon | LexusIcon | Icon displayed before the text | ✅ |
trailingIcon | ToyotaIcon | LexusIcon | Icon displayed after the text | ✅ |
Example
Section titled “Example”import { PillButton } from '@tmedxp/react-components';
const PillButtonExample = () => { return <PillButton text="Pill Button" />;};
export { PillButtonExample };Accessibility
Section titled “Accessibility”Pill Buttons are interactive components that combine text and optional icons to trigger an action. Because they are often used in dynamic contexts such as filters, tag selections, or overlays, it’s essential that they remain fully perceivable, operable, and understandable across all devices and assistive technologies.
For Design
Section titled “For Design”To ensure Pill Buttons meet accessibility standards across platforms, please follow this implementation checklist. These recommendations align with WCAG 2.2 AA and EN 301 549 standards, supporting keyboard navigation, screen readers, and assistive technologies.
Screen reader support
Section titled “Screen reader support”- Use semantic
<button>elements for all Pill Buttons. - Each button must include a descriptive text label that indicates its action or purpose.
- When used as filters or toggles, use
aria-pressed="true/false"to communicate state to assistive technologies. - Decorative icons must be hidden from screen readers (
aria-hidden="true"). - Do not use
<div>or<span>styled as buttons — these break keyboard navigation and ARIA semantics.
Keyboard navigation
Section titled “Keyboard navigation”- Buttons must be focusable via Tab and activatable with Enter or Space.
- Maintain a visible focus state at all times, following the visual reading order.
- Avoid intercepting default keyboard behaviour (e.g. arrow keys for lists or filters).
Motion sensitivity and feedback
Section titled “Motion sensitivity and feedback”- Avoid animations that trigger on hover or focus without user interaction.
- Respect the user’s
prefers-reduced-motionsystem setting to prevent motion sickness or discomfort. - Transitions should be subtle and non-essential to understanding the state change.
For Dev
Section titled “For Dev”ARIA and markup
Section titled “ARIA and markup”- Ensure the button text is always exposed to assistive technology — don’t replace it entirely with an icon.
- Provide clear ARIA roles and states for interactive variants (e.g. filters, tags, toggles).
- For asynchronous actions (spinners or loaders), add
aria-busy="true"until the action completes. - Use
aria-live="polite"regions for dynamic status updates if the button triggers content changes.
Testing and validation
Section titled “Testing and validation”- All Pill Buttons must be tested using automated accessibility tools such as Axe, Lighthouse, or Accessibility Insights before release.
- Verify focus visibility under both light and dark modes.
- Manually test with keyboard and screen readers to ensure expected behaviour.
Minimum touch area
Section titled “Minimum touch area”To ensure accessibility and ease of interaction across devices, all interactive elements — including Pill Buttons — must respect a minimum touch target size.
Absolute minimum: 24 × 24 px — This is the lowest technical requirement referenced in accessibility documentation. It ensures that the component can still be reached, but does not guarantee an optimal experience for all users.
Recommended best practice: 44 × 44 px — This follows WCAG 2.5.5 Target Size (Level AA) and EN 301 549 guidance. Provides a more comfortable interaction area for users with motor difficulties, touch devices, or when using a device outdoors. Should be considered the default requirement in our design system.
The minimum target size applies regardless of the visual size of the Pill Button. If the visible area is smaller, add invisible padding to meet the accessibility requirement. Maintain consistent spacing between pills to prevent overlapping touch areas. Consistency is key: apply the same rule across all sizes (LG, MD, SM).
Do
Add invisible padding around Pills when needed to expand the touch target (without altering the visual appearance), ensure Pills remain easily tappable in responsive layouts and mobile contexts, and keep sufficient spacing between adjacent Pills (at least 8 px horizontally / 4 px vertically).
Don't
Don’t rely solely on the visible shape to define the touch area, don’t define touch areas smaller than 24 × 24 px (even for compact Pills), and avoid placing multiple Pills so close that their touch areas overlap — that hinders accessibility.
Content / Copy Guidelines
Section titled “Content / Copy Guidelines”Pill Buttons can trigger an action or represent a selectable state — for example, when used as filters or tags. Their text must clearly describe what they do or what they represent, keeping phrasing short, accessible, and easy to translate.
Keep labels concise
Section titled “Keep labels concise”- Use 1–2 words for filters, 1–3 words for actions.
- Keep copy short and scannable to support responsive behaviour.
Descriptive text
Section titled “Descriptive text”- Use clear, specific text that communicates either an action (e.g. Apply, Show all) or a state (e.g. Electric, In stock).
Avoid vague labels
Section titled “Avoid vague labels”- Do not use generic or meaningless labels such as OK, Click, Select, or Filter.
Logical label
Section titled “Logical label”- The label should make sense on its own — users shouldn’t need to read nearby text to understand it.
Character limit
Section titled “Character limit”- Keep text under 24–30 characters to maintain consistency across translations and responsive layouts.
- Allow flexibility for longer words in languages such as German or Finnish.
- Do not truncate button text: use text wrapping when necessary to preserve meaning and accessibility.
Language and tone
Section titled “Language and tone”- Use clear, neutral phrasing that can be easily localised.
- Avoid idioms, humour, or culture-specific references that might not translate well.
Sentence case
Section titled “Sentence case”- Always use sentence case (e.g. Apply filter, not APPLY FILTER).
Punctuation
Section titled “Punctuation”- Avoid punctuation unless strictly necessary (e.g. no full stops).
Styling
Section titled “Styling”The visualised swatches and full token values live at Foundations → Color.
Colors
Section titled “Colors”| Token | Applied as | Applied to |
|---|---|---|
buttons-pill-button-neutral-rested-border-color | Border color | Pill Button |
buttons-pill-button-neutral-rested-foreground-color | Text color | Button label |
buttons-pill-button-neutral-hover-fill-color | Background color | Pill Button |
buttons-pill-button-neutral-hover-foreground-color | Text color | Button label |
buttons-pill-button-neutral-selected-fill-color | Background color | Pill Button |
buttons-pill-button-neutral-selected-foreground-color | Text color | Button label |
buttons-pill-button-neutral-disabled-fill-color | Background color | Pill Button |
buttons-pill-button-neutral-disabled-foreground-color | Text color | Button Label |
color-border-focus-neutral-default | Border color | Pill Button |
Text Styles
Section titled “Text Styles”| Token | Applied as | Applied to |
|---|---|---|
buttons-sm-font-size | Text style | Button Label |
buttons-md-font-size | Text style | Button Label |
buttons-lg-font-size | Text style | Button Label |