Skip to main content
Version: 3.0.0-beta

Text Field

Text fields allow users to input, edit, and display text. They can be used in forms, feedback, and other input-required fields.

Usage

To use the TextField, import it from your components and pass the value, onChange, and other props according to the use case.

Basic Text Field

A simple text field with minimal configuration.

import React, { useState } from "react";
import { TextField } from "@firecms/ui";

export default function TextFieldBasicDemo() {
const [value, setValue] = useState("");

return (
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Basic Text Field"
placeholder="Enter text"
/>
);
}

Multiline Text Field

A text field that supports multiline, useful for larger text inputs like comments or notes.

import React, { useState } from "react";
import { TextField } from "@firecms/ui";

export default function TextFieldMultilineDemo() {
const [value, setValue] = useState("");

return (
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Multiline Text Field"
placeholder="Enter text"
multiline
rows={4}
/>
);
}

Text Field Sizes

Demonstrating different sizes for the text field component.

import React, { useState } from "react";
import { TextField } from "@firecms/ui";

export default function TextFieldSizeDemo() {
const [value, setValue] = useState("");

return (
<div className="flex flex-col gap-4">
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Smallest Size"
placeholder="Smallest size"
size="smallest"
/>
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Small Size"
placeholder="Small size"
size="small"
/>
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Medium Size"
placeholder="Medium size"
size="medium"
/>
</div>
);
}

Text Field with Adornment

Text Field with an end adornment, often used for icons, action buttons, or informative text.

import React, { useState } from "react";
import { TextField } from "@firecms/ui";

export default function TextFieldAdornmentDemo() {
const [value, setValue] = useState("");

return (
<TextField
value={value}
onChange={(e) => setValue(e.target.value)}
label="Text Field with Adornment"
placeholder="Enter text"
endAdornment={<span>@</span>}
/>
);
}
Sign up to our newsletter to get the latest news and updates. No spam!