text-input.tsx 665 B

12345678910111213141516
  1. // Simple built-in components using the single DashboardFormComponent interface
  2. import { Input } from '@/vdb/components/ui/input.js';
  3. import { DashboardFormComponent } from '@/vdb/framework/form-engine/form-engine-types.js';
  4. import { isReadonlyField } from '@/vdb/framework/form-engine/utils.js';
  5. /**
  6. * @description
  7. * A component for displaying a text input.
  8. *
  9. * @docsCategory form-components
  10. * @docsPage TextInput
  11. */
  12. export const TextInput: DashboardFormComponent = ({ value, onChange, fieldDef }) => {
  13. const readOnly = isReadonlyField(fieldDef);
  14. return <Input value={value ?? ''} onChange={e => onChange(e.target.value)} disabled={readOnly} />;
  15. };