Clickable
A generic interactive container component that provides a flexible alternative for custom interactive elements not achievable with existing components like Button or Link. Use it to apply specific styling such as backgrounds, padding, or borders.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstring
A label that describes the purpose or contents of the element. When set, it will be announced to users using assistive technologies and will provide them with more context.
Only use this when the element's content is not enough context for users using assistive technologies.
- Anchor to accessibilityRoleaccessibilityRoleAccessibilityRole
Sets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
- Anchor to accessibilityVisibilityaccessibilityVisibility"visible" | "hidden" | "exclusive"
Changes the visibility of the element.
visible
: the element is visible to all users.hidden
: the element is removed from the accessibility tree but remains visible.exclusive
: the element is visually hidden but remains in the accessibility tree.
- Anchor to backgroundbackgroundBackgroundColorKeyword
Adjust the background of the element.
- Anchor to blockSizeblockSizeSizeUnitsOrAuto
Adjust the block size.
- Anchor to borderborderBorderShorthand
Set the border via the shorthand property.
This can be a size, optionally followed by a color, optionally followed by a style.
If the color is not specified, it will be
base
.If the style is not specified, it will be
auto
.Values can be overridden by
,
, and
.
- Anchor to borderColorborderColor"" | ColorKeyword
Set the color of the border.
If set, it takes precedence over the
border
property's color.- Anchor to borderRadiusborderRadiusMaybeAllValuesShorthandProperty<BoxBorderRadii>
Set the radius of the border.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
start-start start-end end-end end-start
- 3 values:
start-start (start-end & end-start) start-end
- 2 values:
(start-start & end-end) (start-end & end-start)
For example:
small-100
means start-start, start-end, end-end and end-start border radii aresmall-100
.small-100 none
means start-start and end-end border radii aresmall-100
, start-end and end-start border radii arenone
.small-100 none large-100
means start-start border radius issmall-100
, start-end border radius isnone
, end-end border radius islarge-100
and end-start border radius isnone
.small-100 none large-100 small-100
means start-start border radius issmall-100
, start-end border radius isnone
, end-end border radius islarge-100
and end-start border radius issmall-100
.
- 4 values:
- Anchor to borderStyleborderStyle"" | MaybeAllValuesShorthandProperty<BoxBorderStyles>
Set the style of the border.
If set, it takes precedence over the
border
property's style.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
- Anchor to borderWidthborderWidth"" | MaybeAllValuesShorthandProperty<"small" | "small-100" | "base" | "large" | "large-100" | "none">
Set the width of the border.
If set, it takes precedence over the
border
property's width.Like CSS, up to 4 values can be specified.
If one value is specified, it applies to all sides.
If two values are specified, they apply to the block sides and inline sides respectively.
If three values are specified, they apply to the block-start, both inline sides, and block-end respectively.
If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
- Anchor to commandcommand'--auto' | '--show' | '--hide' | '--toggle'Default: '--auto'
Sets the action the command should take when this clickable is activated.
See the documentation of particular components for the actions they support.
--auto
: a default action for the target component.--show
: shows the target component.--hide
: hides the target component.--toggle
: toggles the target component.
- Anchor to commandForcommandForstring
Sets the element the commandFor should act on when this clickable is activated.
- Anchor to disableddisabledboolean
Disables the clickable, meaning it cannot be clicked or receive focus.
In this state, onClick will not fire. If the click event originates from a child element, the event will immediately stop propagating from this element.
However, items within the clickable can still receive focus and be interacted with.
This has no impact on the visual state by default, but developers are encouraged to style the clickable accordingly.
- Anchor to displaydisplayMakeResponsive<"auto" | "none">
Sets the outer display type of the component. The outer type sets a component's participation in flow layout.
auto
the component's initial value. The actual value depends on the component and context.none
hides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
- Anchor to downloaddownloadstring
Causes the browser to treat the linked URL as a download with the string being the file name. Download only works for same-origin URLs, or the blob: and data: schemes.
- Anchor to hrefhrefstring
The URL to link to.
- If set, it will navigate to the location specified by
href
after executing theclick
event. - If a
is set, the
command
will be executed instead of the navigation.
- If set, it will navigate to the location specified by
- Anchor to inlineSizeinlineSizeSizeUnitsOrAuto
Adjust the inline size.
- Anchor to interestForinterestForstring
Sets the element the interestFor should act on when this clickable is activated.
- Anchor to loadingloadingboolean
Disables the clickable, and indicates to assistive technology that the loading is in progress.
This also disables the clickable.
- Anchor to maxBlockSizemaxBlockSizeSizeUnitsOrNone
Adjust the maximum block size.
- Anchor to maxInlineSizemaxInlineSizeSizeUnitsOrNone
Adjust the maximum inline size.
- Anchor to minBlockSizeminBlockSizeSizeUnits
Adjust the minimum block size.
- Anchor to minInlineSizeminInlineSizeSizeUnits
Adjust the minimum inline size.
- Anchor to overflowoverflow"visible" | "hidden"
Sets the overflow behavior of the element.
hidden
: clips the content when it is larger than the element’s container. The element will not be scrollable and the users will not be able to access the clipped content by dragging or using a scroll wheel on a mouse.visible
: the content that extends beyond the element’s container is visible.
- Anchor to paddingpaddingMakeResponsive<MaybeAllValuesShorthandProperty<PaddingKeyword>>
Adjust the padding of all edges.
1-to-4-value syntax is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is:
- 4 values:
block-start inline-end block-end inline-start
- 3 values:
block-start inline block-end
- 2 values:
block inline
For example:
large
means block-start, inline-end, block-end and inline-start paddings arelarge
.large none
means block-start and block-end paddings arelarge
, inline-start and inline-end paddings arenone
.large none large
means block-start padding islarge
, inline-end padding isnone
, block-end padding islarge
and inline-start padding isnone
.large none large small
means block-start padding islarge
, inline-end padding isnone
, block-end padding islarge
and inline-start padding issmall
.
A padding value of
auto
will use the default padding for the closest container that has had its usual padding removed.padding
also accepts a responsive value string with the supported PaddingKeyword as a query value.- 4 values:
- Anchor to paddingBlockpaddingBlockMakeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>
Adjust the block-padding.
large none
means block-start padding islarge
, block-end padding isnone
.
This overrides the block value of
padding
.also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to paddingBlockEndpaddingBlockEndMakeResponsive<"" | PaddingKeyword>
Adjust the block-end padding.
This overrides the block-end value of
.
also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to paddingBlockStartpaddingBlockStartMakeResponsive<"" | PaddingKeyword>
Adjust the block-start padding.
This overrides the block-start value of
.
also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to paddingInlinepaddingInlineMakeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>
Adjust the inline padding.
large none
means inline-start padding islarge
, inline-end padding isnone
.
This overrides the inline value of
padding
.also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to paddingInlineEndpaddingInlineEndMakeResponsive<"" | PaddingKeyword>
Adjust the inline-end padding.
This overrides the inline-end value of
.
also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to paddingInlineStartpaddingInlineStartMakeResponsive<"" | PaddingKeyword>
Adjust the inline-start padding.
This overrides the inline-start value of
.
also accepts a responsive value string with the supported PaddingKeyword as a query value.
- Anchor to targettarget"auto" | AnyString | "_blank" | "_self" | "_parent" | "_top"
Specifies where to display the linked URL.
- Anchor to typetype"button" | "reset" | "submit"
The behavior of the button.
submit
: Used to indicate the component acts as a submit button, meaning it submits the closest form.button
: Used to indicate the component acts as a button, meaning it has no default action.reset
: Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values).
This property is ignored if the component supports
href
or/
command
and one of them is set.
Clickable
- accessibilityLabel
A label that describes the purpose or contents of the element. When set, it will be announced to users using assistive technologies and will provide them with more context. Only use this when the element's content is not enough context for users using assistive technologies.
string
- accessibilityRole
Sets the semantic meaning of the component’s content. When set, the role will be used by assistive technologies to help users navigate the page.
AccessibilityRole
- accessibilityVisibility
Changes the visibility of the element. - `visible`: the element is visible to all users. - `hidden`: the element is removed from the accessibility tree but remains visible. - `exclusive`: the element is visually hidden but remains in the accessibility tree.
"visible" | "hidden" | "exclusive"
- adoptedCallback
() => void
- attributeChangedCallback
(name: string) => void
- background
Adjust the background of the element.
BackgroundColorKeyword
- blockSize
Adjust the block size.
SizeUnitsOrAuto
- border
Set the border via the shorthand property. This can be a size, optionally followed by a color, optionally followed by a style. If the color is not specified, it will be `base`. If the style is not specified, it will be `auto`. Values can be overridden by `borderWidth`, `borderStyle`, and `borderColor`.
BorderShorthand
- borderColor
Set the color of the border. If set, it takes precedence over the `border` property's color.
"" | ColorKeyword
- borderRadius
Set the radius of the border. [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is: - 4 values: `start-start start-end end-end end-start` - 3 values: `start-start (start-end & end-start) start-end` - 2 values: `(start-start & end-end) (start-end & end-start)` For example: - `small-100` means start-start, start-end, end-end and end-start border radii are `small-100`. - `small-100 none` means start-start and end-end border radii are `small-100`, start-end and end-start border radii are `none`. - `small-100 none large-100` means start-start border radius is `small-100`, start-end border radius is `none`, end-end border radius is `large-100` and end-start border radius is `none`. - `small-100 none large-100 small-100` means start-start border radius is `small-100`, start-end border radius is `none`, end-end border radius is `large-100` and end-start border radius is `small-100`.
MaybeAllValuesShorthandProperty<BoxBorderRadii>
- borderStyle
Set the style of the border. If set, it takes precedence over the `border` property's style. Like CSS, up to 4 values can be specified. If one value is specified, it applies to all sides. If two values are specified, they apply to the block sides and inline sides respectively. If three values are specified, they apply to the block-start, both inline sides, and block-end respectively. If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
"" | MaybeAllValuesShorthandProperty<BoxBorderStyles>
- borderWidth
Set the width of the border. If set, it takes precedence over the `border` property's width. Like CSS, up to 4 values can be specified. If one value is specified, it applies to all sides. If two values are specified, they apply to the block sides and inline sides respectively. If three values are specified, they apply to the block-start, both inline sides, and block-end respectively. If four values are specified, they apply to the block-start, block-end, inline-start, and inline-end sides respectively.
"" | MaybeAllValuesShorthandProperty<"small" | "small-100" | "base" | "large" | "large-100" | "none">
- click
Like the standard `element.click()`, but you can influence the behavior with a `sourceEvent`. For example, if the `sourceEvent` was a middle click, or has particular keys held down, components will attempt to produce the desired behavior on links, such as opening the page in the background tab.
({ sourceEvent }?: ClickOptions) => void
- command
Sets the action the [command](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#command) should take when this clickable is activated. See the documentation of particular components for the actions they support. - `--auto`: a default action for the target component. - `--show`: shows the target component. - `--hide`: hides the target component. - `--toggle`: toggles the target component.
'--auto' | '--show' | '--hide' | '--toggle'
- commandFor
Sets the element the [commandFor](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#commandfor) should act on when this clickable is activated.
string
- connectedCallback
() => void
- disabled
Disables the clickable, meaning it cannot be clicked or receive focus. In this state, onClick will not fire. If the click event originates from a child element, the event will immediately stop propagating from this element. However, items within the clickable can still receive focus and be interacted with. This has no impact on the visual state by default, but developers are encouraged to style the clickable accordingly.
boolean
- disconnectedCallback
() => void
- display
Sets the outer [display](https://developer.mozilla.org/en-US/docs/Web/CSS/display) type of the component. The outer type sets a component's participation in [flow layout](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_flow_layout). - `auto` the component's initial value. The actual value depends on the component and context. - `none` hides the component from display and removes it from the accessibility tree, making it invisible to screen readers.
MakeResponsive<"auto" | "none">
- download
Causes the browser to treat the linked URL as a download with the string being the file name. Download only works for same-origin URLs, or the blob: and data: schemes.
string
- href
The URL to link to. - If set, it will navigate to the location specified by `href` after executing the `click` event. - If a `commandFor` is set, the `command` will be executed instead of the navigation.
string
- inlineSize
Adjust the inline size.
SizeUnitsOrAuto
- interestFor
Sets the element the [interestFor](https://open-ui.org/components/interest-invokers.explainer/#the-pitch-in-code) should act on when this clickable is activated.
string
- loading
Disables the clickable, and indicates to assistive technology that the loading is in progress. This also disables the clickable.
boolean
- maxBlockSize
Adjust the maximum block size.
SizeUnitsOrNone
- maxInlineSize
Adjust the maximum inline size.
SizeUnitsOrNone
- minBlockSize
Adjust the minimum block size.
SizeUnits
- minInlineSize
Adjust the minimum inline size.
SizeUnits
- overflow
Sets the overflow behavior of the element. - `hidden`: clips the content when it is larger than the element’s container. The element will not be scrollable and the users will not be able to access the clipped content by dragging or using a scroll wheel on a mouse. - `visible`: the content that extends beyond the element’s container is visible.
"visible" | "hidden"
- padding
Adjust the padding of all edges. [1-to-4-value syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties#edges_of_a_box) is supported. Note that, contrary to the CSS, it uses flow-relative values and the order is: - 4 values: `block-start inline-end block-end inline-start` - 3 values: `block-start inline block-end` - 2 values: `block inline` For example: - `large` means block-start, inline-end, block-end and inline-start paddings are `large`. - `large none` means block-start and block-end paddings are `large`, inline-start and inline-end paddings are `none`. - `large none large` means block-start padding is `large`, inline-end padding is `none`, block-end padding is `large` and inline-start padding is `none`. - `large none large small` means block-start padding is `large`, inline-end padding is `none`, block-end padding is `large` and inline-start padding is `small`. A padding value of `auto` will use the default padding for the closest container that has had its usual padding removed. `padding` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<MaybeAllValuesShorthandProperty<PaddingKeyword>>
- paddingBlock
Adjust the block-padding. - `large none` means block-start padding is `large`, block-end padding is `none`. This overrides the block value of `padding`. `paddingBlock` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>
- paddingBlockEnd
Adjust the block-end padding. This overrides the block-end value of `paddingBlock`. `paddingBlockEnd` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | PaddingKeyword>
- paddingBlockStart
Adjust the block-start padding. This overrides the block-start value of `paddingBlock`. `paddingBlockStart` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | PaddingKeyword>
- paddingInline
Adjust the inline padding. - `large none` means inline-start padding is `large`, inline-end padding is `none`. This overrides the inline value of `padding`. `paddingInline` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | MaybeTwoValuesShorthandProperty<PaddingKeyword>>
- paddingInlineEnd
Adjust the inline-end padding. This overrides the inline-end value of `paddingInline`. `paddingInlineEnd` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | PaddingKeyword>
- paddingInlineStart
Adjust the inline-start padding. This overrides the inline-start value of `paddingInline`. `paddingInlineStart` also accepts a [responsive value](/docs/api/app-home/using-polaris-components#responsive-values) string with the supported PaddingKeyword as a query value.
MakeResponsive<"" | PaddingKeyword>
- queueRender
Queue a run of the render function. You shouldn't need to call this manually - it should be handled by changes to @property values.
() => void
- setAttribute
(name: string, value: string) => void
- target
Specifies where to display the linked URL.
"auto" | AnyString | "_blank" | "_self" | "_parent" | "_top"
- type
The behavior of the button. - `submit`: Used to indicate the component acts as a submit button, meaning it submits the closest form. - `button`: Used to indicate the component acts as a button, meaning it has no default action. - `reset`: Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values). This property is ignored if the component supports `href` or `commandFor`/`command` and one of them is set.
"button" | "reset" | "submit"
declare class Clickable extends Clickable_base implements ClickableProps {
accessor disabled: ClickableProps['disabled'];
accessor loading: ClickableProps['loading'];
accessor target: ClickableProps['target'];
accessor href: ClickableProps['href'];
accessor download: ClickableProps['download'];
accessor type: ClickableProps['type'];
constructor();
}
AnyString
Prevents widening string literal types in a union to `string`.
string & {}
AccessibilityRole
'main' | 'header' | 'footer' | 'section' | 'aside' | 'navigation' | 'ordered-list' | 'list-item' | 'list-item-separator' | 'unordered-list' | 'separator' | 'status' | 'alert' | 'generic' | 'presentation' | 'none'
BackgroundColorKeyword
'transparent' | ColorKeyword
ColorKeyword
'subdued' | 'base' | 'strong'
SizeUnitsOrAuto
SizeUnits | 'auto'
SizeUnits
`${number}px` | `${number}%` | `0`
SizeUnitsOrNone
SizeUnits | 'none'
MakeResponsive
T | `@container${string}`
MaybeAllValuesShorthandProperty
T | `${T} ${T}` | `${T} ${T} ${T}` | `${T} ${T} ${T} ${T}`
PaddingKeyword
SizeKeyword | 'none'
SizeKeyword
'small-500' | 'small-400' | 'small-300' | 'small-200' | 'small-100' | 'small' | 'base' | 'large' | 'large-100' | 'large-200' | 'large-300' | 'large-400' | 'large-500'
MaybeTwoValuesShorthandProperty
T | `${T} ${T}`
BorderShorthand
Represents a shorthand for defining a border. It can be a combination of size, optionally followed by color, optionally followed by style.
BorderSizeKeyword | `${BorderSizeKeyword} ${ColorKeyword}` | `${BorderSizeKeyword} ${ColorKeyword} ${BorderStyleKeyword}`
BorderSizeKeyword
SizeKeyword | 'none'
BorderStyleKeyword
'none' | 'solid' | 'dashed' | 'dotted' | 'auto'
BoxBorderStyles
'auto' | 'none' | 'solid' | 'dashed'
BoxBorderRadii
'small' | 'small-200' | 'small-100' | 'base' | 'large' | 'large-100' | 'large-200' | 'none'
ClickOptions
- sourceEvent
The event you want to influence the synthetic click.
ActivationEventEsque
export interface ClickOptions {
/**
* The event you want to influence the synthetic click.
*/
sourceEvent?: ActivationEventEsque;
}
ActivationEventEsque
- button
number
- ctrlKey
boolean
- metaKey
boolean
- shiftKey
boolean
export interface ActivationEventEsque {
shiftKey: boolean;
metaKey: boolean;
ctrlKey: boolean;
button: number;
}
Anchor to eventsEvents
Learn more about registering events.
- Anchor to blurblurCallbackEventListener<typeof tagName> | null
- Anchor to clickclickCallbackEventListener<typeof tagName> | null
- Anchor to focusfocusCallbackEventListener<typeof tagName> | null
ClickableEvents
- blur
CallbackEventListener<typeof tagName> | null
- click
CallbackEventListener<typeof tagName> | null
- focus
CallbackEventListener<typeof tagName> | null
export interface ClickableEvents {
click: CallbackEventListener<typeof tagName> | null = null;
blur: CallbackEventListener<typeof tagName> | null = null;
focus: CallbackEventListener<typeof tagName> | null = null;
}
CallbackEventListener
(EventListener & {
(event: CallbackEvent<T>): void;
}) | null
CallbackEvent
Event & {
currentTarget: HTMLElementTagNameMap[T];
}
Code
examples
Code
<s-clickable padding="base">Create Store</s-clickable> <s-clickable border="base" padding="base" background="subdued" borderRadius="base" > View Shipping Settings </s-clickable>
<!DOCTYPE html><html><head><style>html, body {height:100%} body {box-sizing: border-box; margin: 0; padding:0.5rem; display: grid; place-items: center; gap: 0.5rem;}</style><script src="https://cdn.shopify.com/shopifycloud/app-bridge-ui-experimental.js"></script></head><body><s-clickable padding="base">Create Store</s-clickable> <s-clickable border="base" padding="base" background="subdued" borderRadius="base" > View Shipping Settings </s-clickable> </body></html>