fieldsForTable
fieldsForTable(
table):Record<string,FieldComponent>
Defined in: packages/ui/src/fields/field-for-column.ts:97
Given a Drizzle table, returns a map of column names to their inferred TypedField components.
Iterates over the table’s entries, identifies columns by duck-typing
(dataType and name properties), and delegates to fieldForColumn
for each one.
Parameters
Section titled “Parameters”object & Record<string, unknown>
A Drizzle table object whose entries expose column metadata.
Returns
Section titled “Returns”Record<string, FieldComponent>
A record mapping column key names to field component types. Each
component accepts BaseFieldProps and a value prop.
Example
Section titled “Example”import { fieldsForTable } from "@cfast/ui";import { posts } from "~/db/schema";
const fields = fieldsForTable(posts);// fields.title === TextField// fields.createdAt === DateField// fields.published === BooleanField
const TitleField = fields.title;<TitleField value={post.title} />;