Skip to main content

Sign Up Block

SignUp is a controlled registration form block built on MUI.

Installationโ€‹

npm install @nodeblocks/frontend-signup-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
termsOfUseUrl (optional)Target URL for the terms checkbox link (/terms-of-use by default)
privacyPolicyUrl (optional)Target URL for the privacy checkbox link (/privacy-policy by default)
loginUrl (optional)Target URL for the sign-in link (/auth/login by default)
Controlled component

SignUp does not own form state. Keep state in your app and pass it through data. Default shape includes email, password, agreesUserAgreement, and agreesPrivacyPolicy.

Code Examplesโ€‹

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

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

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

Important Propsโ€‹

Core Propsโ€‹

PropTypeRequiredDefaultDescription
dataSignUpFormData ({ email, password, agreesUserAgreement, agreesPrivacyPolicy } 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 name (e.g. email, password, agreesUserAgreement, agreesPrivacyPolicy)

Content Propsโ€‹

PropTypeRequiredDefaultDescription
labels{ signUpTitle?, emailField?, passwordField?, termsOfUse?, privacyPolicy?, signUpButton?, gotoSignIn?, backButton? }NosignUpTitle: 'Create Your Account', emailField: 'Email Address', passwordField: 'Password', termsOfUse: 'Accept the terms of use.', privacyPolicy: 'Accept the privacy policy.', signUpButton: 'Sign Up', gotoSignIn: 'Already have an account? Sign In.', backButton: 'Back to previous page'Override default text labels
placeholders{ emailField?, passwordField? }NoemailField: 'Enter your email address', passwordField: 'Enter your password'Override email/password placeholders
termsOfUseUrlstringNo/terms-of-useTarget URL for terms link
privacyPolicyUrlstringNo/privacy-policyTarget URL for privacy link
loginUrlstringNo/auth/loginTarget URL for "Go to sign in" 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: 3, termsOfUse: 3, privacyPolicy: 0 }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

SignUp also inherits StackProps<'form'> (except children), so standard form/stack props like onSubmit, id, and noValidate are supported. Default block order without overrides: signUpTitle, emailField, passwordField, termsOfUse, privacyPolicy, signUpButton, gotoSignIn, backButton (defaultBlockOrder).

Default UI Blocksโ€‹

BlockBuilt onNotes
SignUp (root)Stack (component="form")Controlled form container; max width 496px, centered card layout
SignUp.SignUpTitleTypographyTitle text block (variant="h4"); override via labels.signUpTitle or children
SignUp.EmailFieldTextFieldEmail input (name="email", autoComplete="username"); default label Email Address, placeholder Enter your email address
SignUp.PasswordFieldTextField + IconButtonPassword input with visibility toggle; autoComplete="new-password"; default label Password, placeholder Enter your password
SignUp.TermsOfUseCheckbox + FormControlLabel + LinkCheckbox (name="agreesUserAgreement"); label is a link to termsOfUseUrl (target="_blank")
SignUp.PrivacyPolicyCheckbox + FormControlLabel + LinkCheckbox (name="agreesPrivacyPolicy"); label is a link to privacyPolicyUrl (target="_blank")
SignUp.SignUpButtonButtonSubmit button (variant="contained", size="large", type="submit", fullWidth)
SignUp.GotoSignInBox + LinkSign-in navigation; uses loginUrl or custom children
SignUp.BackButtonButtonSecondary action (variant="outlined", size="large", type="button", fullWidth); included in default orderโ€”omit from blockOrder if unused

Extra field primitivesโ€‹

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

TypeScriptโ€‹

import {SignUp, SignUpFormData} from '@nodeblocks/frontend-signup-block';

type MySignUpData = SignUpFormData & {
companyName?: string;
};