Field Types¶
Field Types describe what each Field on a Resource stores.
When you add a Field to a Resource, you choose one of these types. Diagonal uses the type to validate input, render the right control on pages, and tell workflows how to read and write the value.
Choosing a type
Pick the narrowest type that fits the value. A clean type set keeps validation strict, pages predictable, and workflow logic simple.
Quick reference¶
| Field type | What it stores | Searchable | Unique |
|---|---|---|---|
| Text | Free-form string | Yes | Yes |
| Email address | Yes | Yes | |
| Phone | Phone number | Yes | Yes |
| Password | Hashed credential | No | No |
| Uuid | UUID identifier | No | Yes |
| Color | Color value | No | No |
| Timezone | IANA timezone | No | No |
| Number | Numeric value | No | Yes |
| Money | Amount and currency | No | No |
| Boolean | True or false | No | No |
| Date | Calendar date | No | Yes |
| Time | Time of day | No | No |
| Datetime | Date and time | No | No |
| Recurrence | Repeating schedule | No | No |
| Content | Rich text document | No | No |
| File | Uploaded file | No | No |
| Dictionary | Keyed object | No | No |
| List | Ordered list of items | No | No |
| Relation | Link to another Resource | No | No |
Text and identifiers¶
Use these for human-readable strings, contact details, and stable identifiers.
Text¶
A free-form string. Use this for names, titles, descriptions, notes, slugs, and other plain or formatted text fields.
| Setting | Why it matters |
|---|---|
| Searchable | Include this field when users search records. |
| Unique | Prevent duplicate values across records. |
Email¶
An email address. Same options as Text, with built-in email validation. Used by Authenticatable and Notifiable Capabilities to identify and contact users.
Phone¶
A phone number. Validated as a phone string and rendered with a phone-friendly input on pages.
Password¶
A password credential. Stored hashed and never displayed back in the admin panel. Pair with Email on an Authenticatable Resource to enable login.
Uuid¶
A UUID identifier. Useful when records need a stable external key separate from internal record IDs.
Color¶
A color value (hex or named color). Pages can render swatches and use the value in styling.
Timezone¶
An IANA timezone string such as America/New_York. Workflows use this to format dates and times for the right user.
Numeric¶
Use numeric fields when the value needs math, sorting, filtering, totals, or currency-aware formatting.
| Type | Best for | Stored value | Supported flags |
|---|---|---|---|
| Number | Counts, scores, quantities, percentages, and measurements. | A single numeric value. | Unique |
| Money | Prices, invoice totals, balances, adjustments, payments, and refunds. | Amount plus currency. | — |
Number¶
Use Number when the value is a count, measurement, rank, score, or any other number that is not currency.
| Setting | Why it matters |
|---|---|
| Integer | Restrict the value to whole numbers. |
| Minimum | Reject values below the threshold. |
| Maximum | Reject values above the threshold. |
Money¶
Use Money when the value represents a price, total, balance, adjustment, payment, refund, or amount owed.
Money fields store both the amount and the currency together so totals stay consistent across records. They work alongside the Payable, Itemizable, Payable Adjustment, Payment, and Refund Capabilities for invoice-style data, and with Stripe-backed payment workflows.
Boolean¶
A true or false value. Useful for flags like Active, Approved, Archived, or Marketing Opt-In.
Date and time¶
Date¶
A calendar date with no time portion. Use this for due dates, birthdays, and similar values where the time of day does not matter.
Time¶
A time of day with no date portion. Use this for daily schedules, opening hours, and time-of-day preferences.
Datetime¶
A specific point in time with both date and time. Use this for timestamps, appointments, and any value that needs to be ordered down to the minute or second.
Recurrence¶
A repeating schedule rule. Use this together with Eventable Resources to drive calendars and recurring appointments.
Rich content¶
Content¶
A rich text document.
Content fields store structured rich text rather than plain HTML, so you can keep the formatting clean and choose which features the editor exposes.
| Setting | Why it matters |
|---|---|
| Multi-line | Allow content to span multiple paragraphs and block-level nodes. |
| Extensions | Toggle inline formatting like bold, italic, strike, and underline. |
| Allowed nodes | Restrict block-level node types when multi-line is enabled. |
Files¶
File¶
An uploaded file such as an image, document, or PDF.
| Setting | Why it matters |
|---|---|
| Accepted file types | Limit uploads to specific MIME types. |
| Visibility | Choose Private (default) or Public. Public files are accessible without authentication. Private files require record access and can be further restricted by Policies. |
Structured data¶
Dictionary¶
A keyed object made up of nested fields.
Use a Dictionary when a value has a fixed inner shape, such as an address with street, city, and postal code, or a settings object with named entries. The inner shape is defined by a nested schema.
List¶
An ordered collection of items.
Use a List when a record can have many of the same kind of value, such as tags, line items, or steps. The shape of each item is defined by a nested schema.
Dictionary vs List vs Relation
Use a Dictionary or List when the data lives inside the parent record. Use a Relation when the data should live in its own Resource and be queried, secured, or reused on its own.
Relations¶
Relation¶
A link from one Resource to another.
Relations are how your app expresses that an Order belongs to a Customer, a Customer has many Orders, an Employee has one Profile, or Students enroll in many Courses. See the Resources guide for the four relation kinds and how to model them.
| Setting | Why it matters |
|---|---|
| Type | Belongs to, Has one, Has many, or Belongs to many. |
| Target resource | The other Resource this field points to. |
| Foreign key | The field on the related Resource that stores the link. |
| Filters | Optional filters that constrain which records the relation can reference. |
| Nullable | Allow the relation to be left empty (Belongs to). |
| Inverse | Optionally expose this relation from the other side. |
Cross-field flags¶
Two flags appear next to most fields. Each flag is supported by a specific subset of types:
| Flag | Supported types |
|---|---|
| Searchable | Text, Email, Phone |
| Unique | Text, Number, Email, Phone, Date, Uuid |
Searchable should be turned on intentionally — every field that opts in adds work to query and indexing paths. Unique is enforced at the database level and rejects records that would create a duplicate value.