Go Pro Sign Up Login

Buy Now and unlock this series

$

49

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Creating a Toggle

The first component we will create for our series is a toggle switch. We will start simple and set it up with some basic styling.

Downloads

Become a pro to download code and videos

Comments

User avatar

Tilman

27 days ago

Maybe a newbie question....but I was wondering if there is a recommended way of using shared css (e.g. when creating a custom component library) without being forced to add a css-file in the app that is using the lib?

Joel

12 months ago [edited]

@Scott, what extension are you using for the autocomplete/predictive text. Also which terminal are you using?

User avatar

Josh

about 1 year ago [edited]

In the real world using a checkbox for a toggle probably isn't ideal. But if you did, you definitely wouldn't want to make the initial check box input display: none. That would erase the keyboard accessibility by removing the input from the DOM.

Heydon Pickering has done some good writing on this topic: https://inclusive-components.design/toggle-button/

Want to join the conversation?

Become a Pro member today!