Skip to content

Login Form with Social Buttons

Tailwind CSS login form with Google and GitHub buttons, remember me, password visibility toggle and accessible inline validation.

Also known as: sign in form, login page with google and github, login form with password toggle, sign in page

Login Form with Social Buttons live demo

Open in new tab

Tailwind CSS code (HTML, JS)

A clean login screen built with Tailwind CSS that combines Google and GitHub sign-in buttons with a classic email and password form, a "Remember me" checkbox, a show/hide password toggle and inline validation. It drops straight into SaaS apps, dashboards and member areas as the sign-in page.

How it works

The root is section.tls-login, a full-height bg-linear-to-br from-teal-50 via-white to-sky-100 background with a masked dot pattern. A translucent card (bg-white/80 backdrop-blur) holds the logo, the heading, two social buttons, an "or" divider and the form marked data-tls-form. The social buttons sit side by side from sm up and stack on narrow phones. Each one carries data-tls-provider with the provider name, and the logos are inline SVG.

The script initializes every .tls-login on DOMContentLoaded. The form has novalidate, so the script handles validation itself: on submit it checks the email against a simple pattern and the password against the input's minlength, writes messages into the data-tls-error paragraphs, sets aria-invalid="true" (which turns the border red through the aria-[invalid=true]: variant) and moves focus to the first invalid field. After the first attempt, errors update live on every input event.

The .tls-reveal button switches the password input between type="password" and type="text", flips aria-pressed and swaps the two icons marked data-tls-eye. On a valid submit, .tls-submit is disabled, the data-tls-spinner icon appears, the data-tls-label text changes to "Signing in…" and a setTimeout stands in for your real request before the data-tls-status region reports success.

Customization

  • from-teal-600 to-sky-600 on .tls-submit and the logo badge: change the gradient to restyle the primary action, e.g. from-indigo-600 to-violet-600.
  • focus:ring-teal-500/20 and focus-visible:outline-teal-600: update together with the gradient so focus states match the new accent.
  • minlength="8" on #tls-password: the script reads this value, so changing it updates both the rule and the error message.
  • data-tls-provider buttons: turn them into a elements pointing at your OAuth routes (for example /auth/google), or add a third provider by copying a button.
  • sm:grid-cols-2 on the social button grid: remove it to always stack the buttons full width.
  • The window.setTimeout block in script.js: replace it with a fetch() call to your login endpoint.
  • max-w-md on the card wrapper: widen the card for longer copy.

Use cases

  • SaaS apps: offers Google and GitHub sign-in alongside a classic email and password form
  • Member areas: Remember me and a show password toggle make returning easier
  • Dashboards: inline validation explains email and password errors without reloading the page
  • Developer tools: provider buttons can link straight to your OAuth routes

Accessibility

Every input has a visible label, correct type and autocomplete values (email, current-password) so password managers work. Error messages are linked through aria-describedby and the invalid state is exposed with aria-invalid. The password toggle is a real button with aria-controls, aria-pressed and a hidden text label that switches between "Show password" and "Hide password". Status messages are announced through a role="status" live region. All controls show a visible focus ring, decorative SVGs are aria-hidden, and the spinner stops spinning with motion-reduce:animate-none.

Usage notes

Client-side validation is for convenience only; always validate on the server too.

Login Form with Social Buttons at a glance

Framework
Tailwind CSS
Code
HTML, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Tailwind CSS
Layout
Responsive, works on mobile
Category
Login & Sign Up
License
Free for personal and commercial use

Questions about this template

Can I use the Login Form with Social Buttons code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Tailwind CSS from a CDN (the links are under Requirements). Paste the HTML where the component should appear and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

The Tailwind browser build is for prototyping. In production, compile Tailwind with its CLI or your bundler.

Login Form with Social Buttons – free Tailwind CSS login & sign up form template
Login Form with Social Buttons · free Tailwind CSS login & sign up form template

More Login & Sign Up

Login Form with Floating Labels – free Pure CSS login & sign up form template

Login Form with Floating Labels

Clean pure CSS login card with animated floating labels, show/hide password, inline validation and a simulated sign-in state in vanilla JavaScript.

Forgot Password Form – free Tailwind CSS login & sign up form template

Forgot Password Form

Tailwind CSS forgot password form with email validation, loading spinner, check-your-inbox success state and a resend cooldown timer.

Signup Form with Validation – free Bootstrap 5 login & sign up form template

Signup Form with Validation

Bootstrap 5 signup form with live password rules, a strength meter, show/hide toggle, password confirmation and a required terms checkbox.

Split Login Page with Image – free Bootstrap 6 login & sign up form template

Split Login Page with Image

Bootstrap 6 split-screen login page with a full-height photo and testimonial on one side and a floating-label form with Google and Apple sign-in on the other.

Forgot Password Form – free Bootstrap 6 login & sign up form template

Forgot Password Form

Bootstrap 6 forgot password form with an email field, inline validation, a loading button, a stepper and a check-your-inbox success state with resend timer.

Login and Signup Tabs – free Bootstrap 6 login & sign up form template

Login and Signup Tabs

Bootstrap 6 card with segmented tabs that switch between a sign-in form and a create-account form, with validation, cross-links and simulated submits.