register.create()
Creates a registration form with validation and callback handling for new account creation.Signature
Parameters
Async callback function triggered when the user successfully submits the registration form.Signature:Parameters:
name: User’s full name (trimmed)email: Email address (trimmed)student_id: Student ID number (trimmed)password: Plain text password (not trimmed - preserves whitespace)
- Create user account in database
- Hash password before storage
- Show success notification
- Navigate to login page or auto-login
- Handle duplicate email errors
Callback function triggered when the user clicks the “Sign in” link at the bottom of the form.Expected behavior:
- Navigate back to login page
- Typically uses
ui.navigate.to('/')or similar routing
Returns
The root container element with class
login-outer scsu-bg. Contains the entire registration UI with left branding panel and right form panel.UI Structure
Split-screen layout matching the login components: Left Panel (42% width)- SCSU logo (inverted/white)
- Blue accent divider
- “Department of Computer Science” label
- “CS Library Registration” heading
- Descriptive text: “Create an account to access the CS Library catalog.”
- Copyright footer
- Diagonal stripe texture overlay
- “Create Account” heading (3rem, bold)
- Blue accent bar
- Instructions: “Fill in your details to get started”
- Five input fields:
- Full Name (person icon, autofocus)
- Email Address (email icon, type=email)
- Student ID (badge icon)
- Password (lock icon, type=password)
- Confirm Password (lock_reset icon, type=password)
- Error message label (red, min-height 1rem)
- “Create Account” button with person_add icon
- Back to login link: “Already have an account? Sign in”
- Live clock display
Form Validation
Client-side validation performed before callingon_register_success:
-
Required fields check: All fields must be non-empty
- Error: “All fields are required.”
-
Password match check: Password and Confirm Password must match
- Error: “Passwords do not match.”
-
Password length check: Minimum 8 characters
- Error: “Password must be at least 8 characters.”
Internal Handler
The component includes an internal async handler that wrapson_register_success:
- Enter key on confirm password field
- Click event on “Create Account” button
Interactive Features
- Autofocus: Name input field has autofocus on page load
- Enter key submission: Pressing Enter on confirm password field submits the form
- Password masking: Password fields use
type=passwordfor secure input - Email validation: Email field uses
type=emailfor browser validation - Back link: “Sign in” link triggers
on_back_to_logincallback
Usage Example
Validation Flow
Styling
Matches the styling oflogin.create() and login_email.create():
- Theme: Dark with
#0a1f44blue left panel - Accent color:
#3b82f6(blue) with glow effects - Font: Space Grotesk
- Input styling: NiceGUI
dark standoutprops withrgba(255,255,255,0.06)background - Button styling: Blue semi-transparent with border and hover glow
Custom CSS Classes
Injected viaui.add_head_html():
.login-outer: Full viewport flex container.left-panel: 42% width branding panel.right-panel: Flexible form panel.stripe-texture: Diagonal stripe overlay.back-link: Blue underlined link with hover effect
Common Patterns
Email Domain Validation
Student ID Format Validation
Password Strength Requirements
Navigation Integration
Error Handling
The error label has a minimum height to prevent layout shifts:See Also
- Login Components - Student ID and email/password login interfaces
- Dashboard Component - Main application UI after registration
- Database Module - User account management functions