Skip to main content
Sonamu automatically generates frontend components based on backend Entity definitions. This document explains what components are generated and when to use them.

Component Types

IdAsyncSelect

Entity record search selectionServer search support

OrderBySelect

Sort option selectionEnum based

SearchFieldSelect

Search target field selectionDynamic search criteria

StatusSelect

Status/role selectionEnum based

1. IdAsyncSelect

Generation Condition

Auto-generated for all Entities.

File Location

Examples:
  • UserIdAsyncSelect.tsx
  • ProjectIdAsyncSelect.tsx
  • CompanyIdAsyncSelect.tsx

Code Structure

Usage Example

Key Features

1. Server Search:
  • Calls backend API with user-entered keyword
  • Display real-time search results
  • Fast search even with large datasets
2. Single/Multi Selection:
3. Custom Labels: By default, it’s in username (email) format, but you can modify the component file directly.
IdAsyncSelect vs Regular Select
  • IdAsyncSelect: Hundreds~thousands+ records (search required)
  • Regular Select: 10~50 or fewer fixed options
Example: Use IdAsyncSelect for user selection, regular Select for role selection (admin/normal)

2. OrderBySelect

Generation Condition

Auto-generated when Entity’s OrderBy enum is defined.

File Location

Code Structure

Usage Example

OrderBy Enum Definition

Defined in the backend.
Auto-generated labels:

3. SearchFieldSelect

Generation Condition

Auto-generated when Entity’s SearchField enum is defined.

File Location

Usage Example

SearchField Enum Definition

Auto-generated labels:
SearchField vs SearchInput
  • SearchFieldSelect: Select search target field (ID, name, email, etc.)
  • Input (keyword): Enter actual search term
Using both together enables dynamic search criteria.

4. StatusSelect (Enum Select)

Generation Condition

Auto-generated when Entity has enum-type fields defined.

File Location

Examples:
  • ProjectStatusSelect.tsx (Project’s status field)
  • UserRoleSelect.tsx (User’s role field)

Usage Examples

List Filtering

Form Input

Enum Definition

Defined in backend Entity.
Auto-generated types:

Component Customization

When to Modify?

Auto-generated components are initial templates and can be modified to fit project requirements. When modification is needed:
  1. Change IdAsyncSelect label format
  2. Change search target Subset
  3. Change defaults like placeholder, className
  4. Add additional filtering logic

Modification Example 1: IdAsyncSelect Label

Modification Example 2: Change Search Subset

By default uses Subset “A”, but can be changed if more info is needed.
Caution When Changing SubsetUsing larger Subsets can degrade search performance. It’s better to create custom Subsets with only necessary fields.

Modification Example 3: Additional Filtering

To search only users meeting certain conditions:

Regeneration Policy

Are these auto-generated files?

No. Generated once and not regenerated afterward.

When regeneration is needed

  1. Entity structure significantly changed
  2. Want to delete existing component and start from scratch
Method:
Scaffolding FilesThese components are “scaffolding files”. They provide initial templates and developers freely modify them afterward. Different from “real-time sync files” like sonamu.generated.ts.

Usage Patterns

List Page Filters

Form Input