Skip to main content

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.

string

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.

Default: 'generic'

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 accessibilityVisibility
accessibilityVisibility
"visible" | "hidden" | "exclusive"
Default: 'visible'

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.
Default: 'transparent'

Adjust the background of the component.

Default: 'auto'

Adjust the block size.

Default: 'none' - equivalent to `none base auto`.

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.

"" |
Default: '' - meaning no override

Adjust the color of the border.

<>
Default: 'none'

Adjust the radius of the border.

"" | <>
Default: '' - meaning no override

Adjust the style of the border.

"" | <"small" | "small-100" | "base" | "large" | "large-100" | "none">
Default: '' - meaning no override

Adjust the width of the border.

'--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.
string

Sets the element the commandFor should act on when this clickable is activated.

boolean

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.

<"auto" | "none">
Default: 'auto'

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.
string

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

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.
Default: 'auto'

Adjust the inline size.

string

Sets the element the interestFor should act on when this clickable is activated.

boolean

Disables the clickable, and indicates to assistive technology that the loading is in progress.

This also disables the clickable.

Default: 'none'

Adjust the maximum block size.

Default: 'none'

Adjust the maximum inline size.

Default: '0'

Adjust the minimum block size.

Default: '0'

Adjust the minimum inline size.

"visible" | "hidden"
Default: 'visible'

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.
<<>>
Default: 'none'

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 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 string with the supported PaddingKeyword as a query value.

<"" | <>>
Default: '' - meaning no override

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 string with the supported PaddingKeyword as a query value.

<"" | >
Default: '' - meaning no override

Adjust the block-end padding.

This overrides the block-end value of paddingBlock.

paddingBlockEnd also accepts a responsive value string with the supported PaddingKeyword as a query value.

<"" | >
Default: '' - meaning no override

Adjust the block-start padding.

This overrides the block-start value of paddingBlock.

paddingBlockStart also accepts a responsive value string with the supported PaddingKeyword as a query value.

<"" | <>>
Default: '' - meaning no override

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 string with the supported PaddingKeyword as a query value.

<"" | >
Default: '' - meaning no override

Adjust the inline-end padding.

This overrides the inline-end value of paddingInline.

paddingInlineEnd also accepts a responsive value string with the supported PaddingKeyword as a query value.

<"" | >
Default: '' - meaning no override

Adjust the inline-start padding.

This overrides the inline-start value of paddingInline.

paddingInlineStart also accepts a responsive value string with the supported PaddingKeyword as a query value.

"auto" | | "_blank" | "_self" | "_parent" | "_top"
Default: 'auto'

Specifies where to display the linked URL.

"button" | "reset" | "submit"
Default: 'button'

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.

Was this section helpful?

Learn more about registering events.

<typeof tagName> | null
<typeof tagName> | null
<typeof tagName> | null
Was this section helpful?

HTMLElement

The content of the Clickable.

Was this section helpful?

Code

<>
<s-clickable padding="base">Create Store</s-clickable>

<s-clickable
border="base"
padding="base"
background="subdued"
borderRadius="base"
>
View Shipping Settings
</s-clickable>
</>

Component examples

A simple clickable button with a base border and padding, demonstrating the default button behavior of the Clickable component.

A disabled submit button that can be used within a form, showing the component's form integration capabilities and disabled state.

Illustrates how the Clickable component can be integrated into a section layout to provide an interactive action button.

Demonstrates the use of an accessibility label to provide context for screen readers, enhancing the component's usability for users with assistive technologies.

Was this section helpful?

Basic Button Usage

<s-clickable border="base" padding="base">
Click me
</s-clickable>