Sign-up card
A registration card with name, email, password rules and a terms checkbox.
Installation
bash
npx bootcn add signup-cardbash
pnpm dlx bootcn add signup-cardbash
yarn dlx bootcn add signup-cardbash
bunx --bun bootcn add signup-cardThe CLI also installs the design tokens and these blocks and components: card, input, checkbox, button. It prints the <link> and <script> tags to add to your layout.
Usage
Point the form's action at your registration handler. Validate on the server too: required and minlength only help the browser give early feedback.
autocomplete="new-password" lets password managers suggest a strong password.
Accessibility
- The password rule is visible help text linked with
aria-describedby, so screen readers announce it with the field. - The terms checkbox is
required; its links stay inside the label so the whole sentence is read together.
Dependencies
- Bootstrap 5.3+ CSS.
themes/tokens/tokens.css.- The
cardcomponent. - The
inputcomponent. - The
checkboxcomponent. - The
buttoncomponent.
Source
The exact files the CLI installs (signup-card@1.0.0). View on GitHub · Report an issue
html
<section class="bootcn-signup-card" aria-labelledby="bootcn-signup-card-title">
<div class="card bootcn-card">
<header class="bootcn-card__header">
<h2 class="bootcn-card__title" id="bootcn-signup-card-title">Create an account</h2>
<p class="bootcn-card__description">It takes less than a minute.</p>
</header>
<form class="bootcn-card__content bootcn-signup-card__form" action="#" method="post">
<div class="bootcn-field">
<label for="bootcn-signup-card-name" class="form-label bootcn-field__label"
>Full name</label
>
<input
type="text"
class="form-control bootcn-input"
id="bootcn-signup-card-name"
name="name"
autocomplete="name"
required
/>
</div>
<div class="bootcn-field">
<label for="bootcn-signup-card-email" class="form-label bootcn-field__label">Email</label>
<input
type="email"
class="form-control bootcn-input"
id="bootcn-signup-card-email"
name="email"
autocomplete="email"
placeholder="you@example.com"
required
/>
</div>
<div class="bootcn-field">
<label for="bootcn-signup-card-password" class="form-label bootcn-field__label"
>Password</label
>
<input
type="password"
class="form-control bootcn-input"
id="bootcn-signup-card-password"
name="password"
autocomplete="new-password"
required
minlength="8"
aria-describedby="bootcn-signup-card-password-help"
/>
<p class="bootcn-field__help" id="bootcn-signup-card-password-help">
At least 8 characters.
</p>
</div>
<div class="form-check bootcn-checkbox">
<input
class="form-check-input bootcn-checkbox__input"
type="checkbox"
id="bootcn-signup-card-terms"
name="terms"
required
/>
<label class="form-check-label bootcn-checkbox__label" for="bootcn-signup-card-terms">
I agree to the <a class="bootcn-signup-card__link" href="#terms">terms</a> and
<a class="bootcn-signup-card__link" href="#privacy">privacy policy</a>
</label>
</div>
<button type="submit" class="btn bootcn-button bootcn-button--default w-100">
Create account
</button>
</form>
<footer class="bootcn-card__footer bootcn-signup-card__footer">
<p class="mb-0">
Already registered? <a class="bootcn-signup-card__link" href="#sign-in">Sign in</a>
</p>
</footer>
</div>
</section>css
.bootcn-signup-card {
width: 100%;
max-width: 24rem;
margin-inline: auto;
}
.bootcn-signup-card__form {
display: flex;
flex-direction: column;
gap: 1rem;
}
.bootcn-signup-card__form .bootcn-field {
margin: 0;
}
.bootcn-signup-card__label-row {
display: flex;
align-items: baseline;
justify-content: space-between;
gap: 1rem;
}
.bootcn-signup-card__link {
color: var(--bs-link-color);
font-size: 0.875rem;
text-underline-offset: 0.2em;
}
.bootcn-signup-card__footer {
justify-content: center;
font-size: 0.875rem;
color: var(--bs-secondary-color);
}
