Components Buttons


Buttons empower you to create interactive elements for a user.
          <.button label="Button" to="/" />
<.button link_type="a" to="/" label="Link" />
<.button link_type="a" to="/" label="Link with method" method={:delete} />
<.button link_type="live_patch" to="/" label="Live Patch" />
<.button link_type="live_redirect" to="/" label="Live Redirect" />

          <.button color="primary" label="Primary" />
<.button color="secondary" label="Secondary" />
<.button color="white" label="White" />
<.button color="pure_white" label="Pure White" />
<.button color="info" label="Info" />
<.button color="success" label="Success" />
<.button color="warning" label="Warning" />
<.button color="danger" label="Danger" />
<.button color="gray" label="Gray" />
<.button color="light" label="Light" />

# Light is unique in that it is designed to adapt subtly to dark mode

          <.button color="primary" label="Primary" variant="outline" />
<.button color="secondary" label="Secondary" variant="outline" />
<.button color="white" label="White" variant="outline" />
<.button color="info" label="Info" variant="outline" />
<.button color="success" label="Success" variant="outline" />
<.button color="warning" label="Warning" variant="outline" />
<.button color="danger" label="Danger" variant="outline" />
<.button color="gray" label="Gray" variant="outline" />
<.button color="light" label="Light" variant="outline" />

          <.button color="primary" label="Primary" variant="inverted" />
<.button color="secondary" label="Secondary" variant="inverted" />
<.button color="white" label="White" variant="inverted" />
<.button color="info" label="Info" variant="inverted" />
<.button color="success" label="Success" variant="inverted" />
<.button color="warning" label="Warning" variant="inverted" />
<.button color="danger" label="Danger" variant="inverted" />
<.button color="gray" label="Gray" variant="inverted" />
<.button color="light" label="Light" variant="inverted" />

          <.button color="primary" label="Primary" variant="shadow" />
<.button color="secondary" label="Secondary" variant="shadow" />
<.button color="white" label="White" variant="shadow" />
<.button color="info" label="Info" variant="shadow" />
<.button color="success" label="Success" variant="shadow" />
<.button color="warning" label="Warning" variant="shadow" />
<.button color="danger" label="Danger" variant="shadow" />
<.button color="gray" label="Gray" variant="shadow" />
<.button color="light" label="Light" variant="shadow" />

          <.button size="xs" label="xs" />
<.button size="sm" label="sm" />
<.button size="md" label="md" />
<.button size="lg" label="lg" />
<.button size="xl" label="xl" />



          <.button disabled size="xs" to="/" label="Disabled xs" />
<.button disabled size="sm" to="/" label="Disabled sm" />
<.button disabled size="md" to="/" label="Disabled md" />
<.button disabled size="lg" to="/" label="Disabled lg" />
<.button disabled size="xl" to="/" label="Disabled xl" />



          <.button loading size="xs" label="Loading xs" />
<.button loading size="sm" label="Loading sm" />
<.button loading size="md" label="Loading md" />
<.button loading size="lg" label="Loading lg" />
<.button loading size="xl" label="Loading xl" />

With icon
          <.button icon={:home} label="Mini" />
<.button with_icon link_type="a" to="/">
  <Heroicons.home solid class="w-5 h-5" /> Solid
<.button with_icon link_type="a" to="/">
  <Heroicons.home class="w-5 h-5" /> Outline

Icon buttons
          <.icon_button tooltip="Clock" size="xs">
  <Heroicons.clock solid />
<.icon_button tooltip="Clock" size="sm" color="secondary">
  <Heroicons.clock solid />
<.icon_button size="md" color="success">
  <Heroicons.trash solid />
  tooltip="Take me to google!"
  <Heroicons.arrow_up_circle solid />
<.icon_button disabled class="!text-green-600">
  <Heroicons.arrow_down_on_square solid />

<.icon_button to="/" loading link_type="button" class="!text-indigo-600 !dark:text-indigo-300">
  <Heroicons.trash solid />

          attr(:size, :string, default: "md", values: ["xs", "sm", "md", "lg", "xl"], doc: "button sizes")

attr(:variant, :string,
  default: "solid",
  values: ["solid", "outline", "inverted", "shadow"],
  doc: "button variant"

attr(:color, :string,
  default: "primary",
  values: [
  doc: "button color"

attr(:to, :string, default: nil, doc: "link path")
attr(:loading, :boolean, default: false, doc: "indicates a loading state")
attr(:disabled, :boolean, default: false, doc: "indicates a disabled state")
attr(:icon, :atom, default: nil, doc: "name of a Heroicon at the front of the button")
attr(:with_icon, :boolean, default: false, doc: "adds some icon base classes")

attr(:link_type, :string,
  default: "button",
  values: ["a", "live_patch", "live_redirect", "button"]

attr(:class, :string, default: "", doc: "CSS class")
attr(:label, :string, default: nil, doc: "labels your button")

attr(:rest, :global,
  include: ~w(method download hreflang ping referrerpolicy rel target type value name)

slot(:inner_block, required: false)