Skip to content

Password field

A password input with a show/hide toggle and an optional four-step strength meter.

CSS + mian.js JSON Markdown Registry item

With strength meter

Installation

Everything ships in one stylesheet and one small script. There is nothing to import per component.

<link rel="stylesheet" href="https://mian.ro/dist/mian.css">
<script src="https://mian.ro/dist/mian.js" defer></script>

Prefer to own the files? /r/password-input.json is a registry item with this component's CSS and example markup, ready to copy into your project with any tool that reads the open registry-item format.

Class reference

Class / attributeDescription
mn-passwordAdd to an mn-input-group that holds the input and the toggle.
mn-password-toggleThe show/hide button. Put both icons inside: .mn-password-show and .mn-password-hide.
mn-password-meter[data-mn-for="#id"]Four <i> segments and a <span> for the label.

Accessibility

  • The toggle is a real button with a fixed label (“Show password”); aria-pressed="true" says the password is visible.
  • The strength label is linked with aria-describedby and announced politely as it changes. Colour is never the only signal.
  • Use autocomplete="new-password" for sign-up and "current-password" for sign-in.
Choose a noodle

Minimal

Flat

Pixel

Linear

Thin

Glass

Textured

Bold

Elegant

Rounded

On this page