Skip to main content

Sign In Block

SignIn is a controlled sign-in form block built on MUI.

Installationโ€‹

npm install @nodeblocks/frontend-signin-block

What You Needโ€‹

ItemWhy it matters
dataSingle source of truth for form state
onDataChangeReceives updated state + metadata for validation/analytics
errors (optional)Displays field-level error feedback
signupUrl (optional)Target URL for the sign-up link (/auth/signup by default)
resetPasswordUrl (optional)Target URL for the forgot-password link (/auth/resetpassword by default)
Controlled component

SignIn does not own form state. Keep state in your app and pass it through data.

Code Examplesโ€‹

Live Editor
function Example() {
  const defaultData = {
    email: '',
    password: '',
  };

  const [data, setData] = React.useState(defaultData);

  return (
    <SignIn
      data={data}
      onDataChange={(nextData) => {
        setData(nextData);
      }}
    />
  );
}
Result
Loading...

Important Propsโ€‹

Core Propsโ€‹

PropTypeRequiredDefaultDescription
dataSignInFormData ({ email, password } or extended Record<string, unknown>)Yes-Current form data object
onDataChange(data, meta) => voidYes-Called on updates; meta includes name, value, cause (input, change, blur, clear, reset, programmatic), optional event
errors{ [fieldName: string]: string | string[] }NoundefinedField errors keyed by data field path (e.g. email, password, or nested paths when data is extended)

Content Propsโ€‹

PropTypeRequiredDefaultDescription
labels{ signInTitle?, emailField?, passwordField?, signInButton?, gotoSignUp?, resetPassword? }NosignInTitle: 'Sign In', emailField: 'Email', passwordField: 'Password', signInButton: 'Sign In', gotoSignUp: 'Create an account', resetPassword: 'Forgot your password?'Override default text labels
placeholders{ emailField?, passwordField? }NoemailField: 'Please enter your email', passwordField: 'Please enter your password'Override email/password placeholders
signupUrlstringNo/auth/signupTarget URL for sign-up link
resetPasswordUrlstringNo/auth/resetpasswordTarget URL for reset password link

Layout and Composition Propsโ€‹

PropTypeRequiredDefaultDescription
childrenBlocksOverride | ReactNodeNoundefinedOverride default blocks or provide custom JSX children
blockSpacingBeforePartial<Record<string, number | Partial<Record<'xs' | 'sm' | 'md' | 'lg' | 'xl', number>>>>No{ passwordField: { xs: 3, sm: 4 } }Theme spacing before listed blocks; applies to default blocks or block override pattern only
componentReact.ElementTypeNo'form'Root element type
classNamestringNoundefinedClass name for the root container
sxSxPropsNoundefinedMUI system styles for the root container

SignIn also inherits StackProps<'form'> (except children), so standard form/stack props like onSubmit, id, and noValidate are supported. Default block order without overrides: signInTitle, emailField, passwordField, signInButton, resetPassword, gotoSignUp (defaultBlockOrder).

Default UI Blocksโ€‹

BlockBuilt onNotes
SignIn (root)Stack (component="form")Controlled form container; max width 496px, centered card layout
SignIn.SignInTitleTypographyTitle text block (variant="h4"); override via labels.signInTitle or children
SignIn.EmailFieldTextFieldEmail input (name="email", autoComplete="username")
SignIn.PasswordFieldTextField + IconButtonPassword input with visibility toggle; autoComplete="current-password"
SignIn.SignInButtonButtonSubmit button (variant="contained", size="large", type="submit", fullWidth)
SignIn.ResetPasswordBox + LinkForgot password link; uses resetPasswordUrl or custom children
SignIn.GotoSignUpBox + LinkSign-up navigation link; uses signupUrl or custom children

Extra field primitivesโ€‹

PrimitiveBuilt onNotes
SignIn.TextFieldTextFieldGeneric text input
SignIn.TimeFieldTextFieldTime input (type="time")
SignIn.CheckboxFieldCheckbox + FormControlCheckbox with helper/error text
SignIn.SelectFieldSelect + TextFieldSelect input rendered through MUI TextField

TypeScriptโ€‹

import {SignIn, SignInFormData} from '@nodeblocks/frontend-signin-block';

type MySignInData = SignInFormData & {
rememberMe?: boolean;
};