---
title: 'Attribute Reference'
description: 'Reference and usage guidance for Attribute Reference.'
---

# Attribute Reference

Attributes define how each field is stored, validated, and rendered.

## Attribute Shape

```tsx
{
  name: 'status',
  label: 'Status',
  scope: 'global',
  dataType: 'string',
  inputType: 'select',
  defaultValue: 'active',
  options: {
    list: [
      { label: 'Active', value: 'active' },
      { label: 'Inactive', value: 'inactive' }
    ],
    comment: 'Operational lifecycle status',
    placeholder: 'Select a status',
    size: 160,
  },
  searchable: true,
  validation: (z) => z.string().min(1, { message: 'Status is required' }),
}
```

## Required Keys

- `name: string`
- `label: string`
- `scope: 'local' | 'global' | 'relationship'`
- `dataType: DataType`
- `inputType: InputType`

## Optional Keys

- `defaultValue?: DefaultValueByDataType[dataType]`
- `previewType?: PreviewType`
- `hidden?: boolean | ((context) => boolean)`
- `readOnly?: boolean | ((context) => boolean)`
- `unique?: boolean`
- `searchable?: boolean`
- `group?: string | string[]`
- `options?: AttributeOptions[inputType]`
- `relationship?: { entity: string; mode: 'single' | 'multiple'; field: string }`
- `validation?: (z) => zodSchema`

`defaultValue` must match `dataType`: use a number for `int` and `float`, a boolean for `boolean`, and a
string for textual and temporal types. An empty string is accepted as the legacy “no default” value; omitting
`defaultValue` is preferred when no default is needed.

## Scope

- `global`: shared across all scopes.
- `local`: scope-specific value.
- `relationship`: relationship field/connection semantics.

## Validation

Flexkit uses a zod callback.

```tsx
validation: (z) => z.number().min(0, { message: 'Must be >= 0' });
```

Use validation for constraints that should block invalid input. Currently-hidden and currently-read-only fields are not validated.

## Flags

- `unique`: marks uniqueness intention. Enforced at deploy for global non-asset attributes.
- `searchable`: includes the field in search indexing and the global search UI.
- `hidden`: hides the field in the form. A static `true` also hides the list column.
- `readOnly`: renders the field as read-only. Currently-read-only attributes are omitted from create/update mutations and skipped during form validation.

These are not the same as `entity.menu.hidden`, which hides the entity from the sidebar menu.

## Field Groups

`group` assigns the attribute to one or more form tabs defined on `entity.groups`. This is not `entity.menu.group` (sidebar section). See [Field Groups](/docs/schema/field-groups).

## Conditional Fields

`hidden` and `readOnly` can be a static boolean or a synchronous callback. See [Conditional Fields](/docs/schema/conditional-fields) for examples and the callback reference.

## Relationship Attributes

When `inputType: 'relationship'`, add:

```tsx
relationship: {
  entity: 'company',
  mode: 'single',
  field: 'name',
}
```

- `entity`: target entity name.
- `mode`: `single` or `multiple`.
- `field`: target attribute used for display/labeling.

## Permission spaces

Use `spaces: ['catalog']` to restrict a supported entity or global/local attribute to members of a deployed space. Membership in any listed space is sufficient. The effective display attribute cannot be space-bound, and relationship-scoped attributes cannot declare spaces. See [permission spaces](/docs/schema/spaces) for deployment and assignment.


---

[View full sitemap](/docs/sitemap.md)
