Corex.Action (Corex v0.2.0)

View Source

Renders a button element for actions based on Phoenix Core Components. Use the type attribute to set the button type. Icon-only buttons must pass aria_label to screen readers.

Anatomy

<.action class="button">Send!</.action>

<.action class="button" phx-click="go">Send!</.action>

<.action class="button" type="submit">Save</.action>

<.action class="button" aria_label="Close dialog">
  <.heroicon name="hero-x-mark" aria-hidden="true" />
</.action>

Style

Import tokens and button.css, then set class="button" on <.action>.

@import "../corex/corex.css";

Stack modifiers on the host. Combine axes, for example button ui-accent ui-size-lg or button ui-info.

Axes: Semantic (ui-accent, ui-brand, ui-alert, ui-info, ui-success), Variant (ui-solid), Size (ui-size-smui-size-xl), Radius (ui-rounded-*). See the modifier guide.

Semantic modifiers set palette variables. Add ui-solid for a filled button. Default is subtle.

Semantic

Palette variables for button ink and fill. Does not change surface treatment by itself.

ModifierClasses
Defaultbutton
Accentbutton ui-accent
Brandbutton ui-brand
Alertbutton ui-alert
Infobutton ui-info
Successbutton ui-success

Variant

ModifierClasses
Subtle (default)button or button ui-accent
Solidbutton ui-accent ui-solid

Size

ModifierClasses
SMbutton ui-size-sm
MDbutton ui-size-md
LGbutton ui-size-lg
XLbutton ui-size-xl

Rounded

ModifierClasses
Nonebutton ui-rounded-none
SMbutton ui-rounded-sm
MDbutton ui-rounded-md
LGbutton ui-rounded-lg
XLbutton ui-rounded-xl
Fullbutton ui-rounded-full

Shape

ModifierClasses
Squarebutton ui-trigger--square
Circlebutton ui-trigger--circle

Summary

Components

action(assigns)

Attributes

  • type (:string) - The button type, defaults to button to prevent accidental form submissions. Defaults to "button". Must be one of "button", "submit", or "reset".
  • aria_label (:string) - Required for icon-only buttons, describes the button to screen readers. Defaults to nil.
  • disabled (:boolean) - Disables the button. Defaults to false.
  • name (:string) - Form input name for submit buttons. Defaults to nil.
  • value (:string) - Form input value for submit buttons. Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)