HiddenField
Hidden field definition for storing values without rendering UI.
Hidden fields participate in the form schema and contribute to form values, but do not render any visible component. They are useful for:
- Storing IDs when updating existing records
- Persisting metadata that shouldn't be user-editable
- Tracking computed values that need to be submitted
Unlike the hidden property on other fields (which hides a rendered field), this field type renders nothing at all - it's a componentless field.
Properties
| Name | Type | Description |
|---|---|---|
| className inherited from | string | undefined | Additional CSS classes for custom styling. Space-separated string of CSS class names that will be applied to the field container for custom styling. |
Example usage | ||
| col inherited from | number | undefined | Column sizing configuration for responsive grid layout. Specifies how many columns this field should span in a 12-column grid system. Supports responsive behavior and field arrangement. |
Example usage | ||
| disabled inherited from | boolean | undefined | Whether the field is disabled and cannot be interacted with. When true, the field is rendered in a disabled state and cannot receive user input. The value can still be modified programmatically. @value false |
| key inherited from | string | Unique field identifier used for form binding and value tracking. This key is used to associate the field with form values and must be unique within the form. It follows object property naming conventions. |
Example usage | ||
| label inherited from | | Human-readable field label displayed to users. Provides accessible labeling for form fields and is typically displayed above or beside the field input. Supports static strings, translation keys, Observables, and Signals for dynamic content. |
Example usage | ||
| meta inherited from | TMeta | undefined | Native HTML attributes to pass through to the underlying element. Contains attributes that are applied directly to the native input/element. Useful for accessibility, autocomplete hints, and custom attributes. The shape is defined by the TMeta generic parameter, which extends FieldMeta. |
Example usage | ||
| props inherited from | TProps | undefined | Field-specific properties and configuration options. Contains type-specific configuration that varies based on the field type. The shape is defined by the TProps generic parameter. |
Example usage | ||
| readonly inherited from | boolean | undefined | Whether the field is read-only. When true, the field displays its value but cannot be modified by user interaction. Differs from disabled in styling and accessibility. @value false |
| tabIndex inherited from | number | undefined | Tab index for keyboard navigation. Controls the order in which fields receive focus when navigating with the Tab key. Follows standard HTML tabindex behavior. |
Example usage | ||
| type overrides | "hidden" | Discriminant for hidden field type |
| value | TValue | The value to store in the form. This is required - a hidden field without a value serves no purpose. |
Example usage
// Store a record ID for updates
const idField: HiddenField <string> = {
type: 'hidden',
key: 'id',
value: '550e8400-e29b-41d4-a716-446655440000',
};
// Store multiple tag IDs
const tagIdsField: HiddenField <number[]> = {
type: 'hidden',
key: 'tagIds',
value: [1, 2, 3],
};