diff --git a/lib/doggo.ex b/lib/doggo.ex index 2e34254d..190dc15b 100644 --- a/lib/doggo.ex +++ b/lib/doggo.ex @@ -1534,6 +1534,52 @@ defmodule Doggo do """ end + @doc """ + Renders a switch as a button. + + If you want to render a switch as part of a form, use the `input/1` component + with the type `"switch"` instead. + + Note that this component only renders a button with a label, a state, and + `` with the class `switch-control`. You will need to style the switch + control span with CSS in order to give it the appearance of a switch. + + ## Examples + + <.switch + label="Subscribe" + checked={true} + phx-click="toggle-subscription" + /> + """ + + attr :label, :string, required: true + attr :on_text, :string, default: "On" + attr :off_text, :string, default: "Off" + attr :checked, :boolean, required: true + attr :rest, :global + + def switch(assigns) do + ~H""" + + """ + end + @doc """ Renders a drawer with a `brand`, `top`, and `bottom` slot.