[whatwg] Add <input> "Switch" Type

Qebui Nehebkau qebui.nehebkau+whatwg at gmail.com
Thu Dec 19 11:52:35 PST 2013

On Wed, Dec 18, 2013 at 6:46 PM, Brian Blakely <anewpage.media at gmail.com> wrote:
> A switch is definitely NOT simply a styled checkbox.  As I mentioned
> earlier, you can slide/drag a switch to change its value.  Also, a switch
> typically animates, whereas a checkbox is essentially a more static
> interaction.

Sounds entirely presentational to me.

>  A switch is often used to indicator more than true/false
> (which should ultimately be represented).

A checkbox and a switch both have two states, which can always be
reduced to true/false in principle. Both are used to indicate things
which may not be superficially boolean, although I would agree that
using a default-styled checkbox for that (though I've seen it in the
wild) is unintuitive.

> Switches on the Web are currently janky, inconsistent and difficult to
> implement.

A good reason to make them easier to implement by styling a checkbox.

> That is essentially the exact same reason that type="week" or
> type="color" have value.  Before formal implementations, they had been
> implemented for a very long time with type="text" and mountains of dubious
> code.

Both have a specific meaning that wasn't adequately provided for by
other input types. We already *have* a two-state input type. Making a
switch out of <input type="checkbox"> isn't abusing anything - it's a
perfectly reasonable alternative presentation for the concept.

More information about the whatwg mailing list