lightdarkdefaultcompact
Getting StartedInstallationChangelogSupportGithubFrameworksAngularVueReactDemosFoundationThemesInternationalizationTypographyIconsPopoversLayoutGetting StartedBlockInlineGridComponentsAccordionAlertAlert GroupBadgeBreadcrumbButtonButton GroupButton ExpandButton HandleButton IconButton ResizeButton SortCardChatCheckboxColorData GridDateDialogDividerDrawerDropdownFileFormat DatetimeFormat NumberFormsForm InteractionsForm ValidationHeaderInputMenuMonthNavPaginationPasswordProgress BarProgress CircleProgress DotRadioRangeRatingSearchSelectStepperSwitchTabsTagTextareaTimeToastToggletipTooltipTreeData GridGetting StartedFooterPlaceholderAsyncResponsiveHeightPaginationBordersHoverLayerRange SelectionCSVColumn AlignmentColumn WidthColumn FixedColumn StickyColumn VisibilityColumn GroupsColumn SpanColumn ResizeDraggable ColumnsDraggable RowsRow HeaderRow Multi SelectRow Single SelectRow HeightRow ActionRow Action BulkRow StickyRow StripeRow FixedRow SortRow Groups

The icon button component is used to provide a visual representation of an action. The button should have a clear and descriptive label that communicates its purpose, such as "Delete" or "Add". The icon should be easily recognizable and match the label's meaning.

Action

code
<section bp-layout="inline gap:md block:center">
  <bp-button-icon shape="menu" aria-label="default"></bp-button-icon>
  <bp-button-icon action="secondary" shape="menu" aria-label="secondary"></bp-button-icon>
  <bp-button-icon action="flat" shape="menu" aria-label="flat"></bp-button-icon>
  <bp-button-icon action="inline" shape="menu" aria-label="inline"></bp-button-icon>
</section>

Status

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
  import '@blueprintui/icons/shapes/filter.js';
  import '@blueprintui/icons/shapes/close.js';
  import '@blueprintui/icons/shapes/menu.js';
</script>

<div bp-layout="inline gap:md">
  <bp-button-icon aria-label="action"></bp-button-icon>
  <bp-button-icon status="accent" aria-label="action"></bp-button-icon>
  <bp-button-icon status="success" aria-label="action"></bp-button-icon>
  <bp-button-icon status="warning" aria-label="action"></bp-button-icon>
  <bp-button-icon status="danger" aria-label="action"></bp-button-icon>
</div>

Flat

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
  import '@blueprintui/icons/shapes/filter.js';
  import '@blueprintui/icons/shapes/close.js';
  import '@blueprintui/icons/shapes/menu.js';
</script>

<div bp-layout="inline gap:md block:center">
  <bp-button-icon action="flat" shape="menu" aria-label="open menu"></bp-button-icon>
  <bp-button-icon action="flat" shape="filter" aria-label="filter column"></bp-button-icon>
  <bp-button-icon action="flat" shape="close" aria-label="close message"></bp-button-icon>
  <bp-button-icon action="flat" aria-label="action"></bp-button-icon>
</div>

Inline

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
  import '@blueprintui/icons/shapes/filter.js';
  import '@blueprintui/icons/shapes/close.js';
  import '@blueprintui/icons/shapes/menu.js';
</script>

<div bp-layout="inline gap:md block:center">
  <bp-button-icon action="inline" shape="menu" aria-label="open menu"></bp-button-icon>
  <bp-button-icon action="inline" shape="filter" aria-label="filter column"></bp-button-icon>
  <bp-button-icon action="inline" shape="close" aria-label="close message"></bp-button-icon>
  <bp-button-icon action="inline" aria-label="action"></bp-button-icon>
</div>

Selected

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
</script>
<div bp-layout="inline gap:md block:center">
  <bp-button-icon selected aria-label="selected"></bp-button-icon>
  <bp-button-icon selected action="secondary" aria-label="secondary selected"></bp-button-icon>
  <bp-button-icon selected action="flat" aria-label="flat selected"></bp-button-icon>
  <bp-button-icon selected action="inline" aria-label="inline selected"></bp-button-icon>
</div>

Pressed

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
</script>
<div bp-layout="inline gap:md block:center">
  <bp-button-icon pressed aria-label="pressed"></bp-button-icon>
  <bp-button-icon pressed action="secondary" aria-label="secondary pressed"></bp-button-icon>
  <bp-button-icon pressed action="flat" aria-label="flat pressed"></bp-button-icon>
  <bp-button-icon pressed action="inline" aria-label="inline pressed"></bp-button-icon>
</div>

The pressed attribute should be used for interactive UI elements that can be toggled on and off. It provides accessibility information to screen reader users about the state of the control, whether it's "true" (pressed), "false" (not pressed), or "mixed".

Disabled

code
<script type="module">
  import '@blueprintui/components/include/button-icon.js';
</script>
<div bp-layout="inline gap:md block:center">
  <bp-button-icon disabled aria-label="action"></bp-button-icon>
  <bp-button-icon disabled action="secondary" aria-label="action"></bp-button-icon>
  <bp-button-icon disabled action="flat" aria-label="action"></bp-button-icon>
  <bp-button-icon disabled action="inline" aria-label="action"></bp-button-icon>
</div>

The disabled attribute should be used for UI elements that are currently disabled, making them uninteractive. This attribute informs assistive technologies like screen readers that the element, while present in the document structure, is not usable or cannot be interacted with in its current state.

Install

NPM

// npm package
import '@blueprintui/components/include/button-icon.js';

CDN

<script type="module">
  import 'https://cdn.jsdelivr.net/npm/@blueprintui/components/include/button-icon.js/+esm';
</script>

Accessibility

  • Use clear, descriptive labels for the button that communicates its purpose.
  • Use aria-label or aria-labelledby to provide a text description of the icon for screen readers.
  • Make sure that the icon alone still conveys its meaning when used out of context.
  • Provide alternative ways for users who have difficulty seeing the icon to understand the button's function, such as by including a text label.

bp-button-icon

Properties

NameTypesDescription
shapestring
direction'up' | 'down' | 'left' | 'right'
i18nset default aria/i18n strings
icon
action'primary' | 'secondary' | 'flat' | 'inline'
status'accent' | 'success' | 'warning' | 'danger'determine the visual status state
pressedbooleanturns the button into a toggle button
selectedbooleanindicate the current "selected" state of various widgets
expandedbooleanindicate if a control is expanded or collapsed
readonlybooleanmakes the element not mutable, meaning the user can not interact with button
disabledbooleandetermines if element is mutable or focusable
type'button' | 'submit'default behavior of the button
namestringrepresents the name of the current
element as a string.
valuestringdetermines the current value
popoverTargetElementHTMLElement
popoverTargetAction| 'toggle' | 'show' | 'hide'
popovertargetstring
formHTMLFormElement
formActionstring
formEnctypestring
formMethodstring
formNoValidateboolean
formTargetstring
labelsNodeListOf
validationMessagestring
validityValidityState
willValidateboolean
checkValidityany
reportValidityany
setCustomValidityany
formAssociatedboolean

Attributes

NameTypesDescription
shapestring
direction'up' | 'down' | 'left' | 'right'
i18nset default aria/i18n strings
action'primary' | 'secondary' | 'flat' | 'inline'
status'accent' | 'success' | 'warning' | 'danger'determine the visual status state
pressedbooleanturns the button into a toggle button
selectedbooleanindicate the current "selected" state of various widgets
expandedbooleanindicate if a control is expanded or collapsed
readonlybooleanmakes the element not mutable, meaning the user can not interact with button
disabledbooleandetermines if element is mutable or focusable
type'button' | 'submit'default behavior of the button
valuestringdetermines the current value
popoverTargetElementHTMLElement
popovertargetaction| 'toggle' | 'show' | 'hide'
popovertargetstring

CSS Properties

NameTypesDescription
--width
--height
--color
--cursor
--background
--padding
--outline
--outline-offset
--border
--min-width
--font-size
--line-height
--text-align

Slots

NameTypesDescription
defaultslot for text content or bp-icon