> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/custom-content-types/columns.md).

# Columns

Configure the columns of your custom tables using the Canvas UI.

Columns are the building blocks of a custom table. Each column maps to a MySQL column and generates a corresponding input field in the record form. Columns are managed in **Step 2** of the [table wizard](/custom-content-types/tables.md) using the [Canvas UI](/canvas-ui/canvas-ui.md).

## Adding a column

In the Columns step, click **Add column** in the sidebar panel. Fill in the column settings in the right-hand panel, then drag it to the desired position in the column list.

<figure><img src="https://3235524095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiyf0tSKPgXiyoQ3zV3I6%2Fuploads%2Fgit-blob-d2499f915f887a604895b3e5ba88705e69a78d40%2Fcct-columns-canvas.png?alt=media" alt="Canvas UI for CCT columns"><figcaption><p>Drag columns to reorder. Click a column to edit its settings in the right panel.</p></figcaption></figure>

## Column settings

Every column has a **name** (database column name, snake\_case) and a **type**. Additional settings depend on the type.

### Core settings (all types)

| Setting                   | Description                                                           |
| ------------------------- | --------------------------------------------------------------------- |
| **Name**                  | Column name in the database. Must be unique within the table.         |
| **Label**                 | Human-readable label shown in the record form.                        |
| **Required**              | Whether a value is required when creating/editing a record.           |
| **Read-only**             | If enabled, the column is shown but cannot be edited in the admin UI. |
| **Default value**         | Pre-populated value for new records.                                  |
| **Show in list**          | Whether this column appears in the records list view.                 |
| **Conditional rendering** | Show/hide this column based on the value of another column.           |
| **Validation rules**      | Apply format constraints (pattern, min/max, etc.).                    |
| **Permissions**           | Per-column role-based access control.                                 |

## Column types

### Text types

| Type         | MySQL type     | Description                         |
| ------------ | -------------- | ----------------------------------- |
| **Text**     | `VARCHAR(255)` | Short text, up to 255 characters.   |
| **Textarea** | `TEXT`         | Long text without formatting.       |
| **Editor**   | `LONGTEXT`     | Rich-text HTML editor (WYSIWYG).    |
| **Password** | `VARCHAR(255)` | Stored as a hashed string.          |
| **URL**      | `VARCHAR(255)` | URL input with format validation.   |
| **Email**    | `VARCHAR(255)` | Email input with format validation. |
| **HTML**     | `LONGTEXT`     | Raw HTML stored as-is.              |

### Numeric types

| Type         | MySQL type      | Description                        |
| ------------ | --------------- | ---------------------------------- |
| **Number**   | `DECIMAL(10,2)` | Decimal number.                    |
| **Integer**  | `BIGINT`        | Whole number.                      |
| **Range**    | `DECIMAL(10,2)` | Number with min/max slider UI.     |
| **Currency** | `DECIMAL(10,2)` | Monetary value with currency code. |
| **Length**   | `DECIMAL(10,2)` | Measurement with unit.             |
| **Weight**   | `DECIMAL(10,2)` | Weight with unit.                  |
| **Rating**   | `TINYINT`       | Star rating (1–5).                 |

### Date/time types

| Type           | MySQL type     | Description                             |
| -------------- | -------------- | --------------------------------------- |
| **Date**       | `DATE`         | Date picker (YYYY-MM-DD).               |
| **Datetime**   | `DATETIME`     | Date and time picker.                   |
| **Time**       | `TIME`         | Time picker (HH:MM).                    |
| **Date range** | `VARCHAR(255)` | Two-date range stored as a JSON string. |

### Boolean / choice types

| Type                | MySQL type     | Description                                                                            |
| ------------------- | -------------- | -------------------------------------------------------------------------------------- |
| **Toggle**          | `TINYINT(1)`   | On/off boolean toggle.                                                                 |
| **Select**          | `VARCHAR(255)` | Single-value dropdown. Options defined inline or from a [Dataset](/tools/datasets.md). |
| **Select multiple** | `JSON`         | Multi-value select.                                                                    |
| **Checkbox**        | `TINYINT(1)`   | Single checkbox.                                                                       |
| **Checkbox list**   | `JSON`         | Multiple checkbox options.                                                             |
| **Radio**           | `VARCHAR(255)` | Single-choice radio buttons.                                                           |
| **Country**         | `VARCHAR(2)`   | Country selector (ISO 3166-1 alpha-2 codes).                                           |

### Media types

| Type        | MySQL type     | Description                                           |
| ----------- | -------------- | ----------------------------------------------------- |
| **Image**   | `VARCHAR(255)` | WordPress media library image (stores attachment ID). |
| **Gallery** | `JSON`         | Multiple images.                                      |
| **File**    | `VARCHAR(255)` | WordPress media library file.                         |
| **Video**   | `VARCHAR(255)` | Video URL or media library item.                      |
| **Audio**   | `VARCHAR(255)` | Audio URL or media library item.                      |

### Structured types

| Type        | MySQL type     | Description                                                 |
| ----------- | -------------- | ----------------------------------------------------------- |
| **Address** | `JSON`         | Full address with geocoding support.                        |
| **Phone**   | `VARCHAR(50)`  | International phone number.                                 |
| **Color**   | `VARCHAR(20)`  | Hex or RGBA color picker.                                   |
| **Icon**    | `VARCHAR(255)` | Icon selector (Dashicons).                                  |
| **QR Code** | `VARCHAR(255)` | Stores the encoded value; QR image is generated on display. |
| **Barcode** | `VARCHAR(255)` | Stores the barcode value; image generated on display.       |
| **JSON**    | `JSON`         | Raw JSON value with syntax-highlighted editor.              |

### Nestable types

| Type         | MySQL type | Description                                                                      |
| ------------ | ---------- | -------------------------------------------------------------------------------- |
| **Repeater** | `VIRTUAL`  | A group of sub-columns that can be repeated any number of times. Stored as JSON. |
| **Flexible** | `VIRTUAL`  | A set of named block templates, each with its own sub-columns. Stored as JSON.   |

#### Repeater columns

A repeater column defines child columns that form a single row. Any number of rows can be added per record. Click **Add child column** inside the repeater to add sub-columns.

#### Flexible block columns

Flexible columns define multiple named *blocks*, each with its own set of child columns. This is useful for modular content structures.

### Relational types

| Type           | Description                                                                                                                 |
| -------------- | --------------------------------------------------------------------------------------------------------------------------- |
| **Relational** | Links a record to one or more records from another CCT table, a CPT post, a taxonomy term, a user, or an option page value. |

See [Relational fields](/custom-content-types/relational-fields.md) for full configuration details and examples.

## Conditional rendering

You can show or hide a column based on the value of another column in the same table. Click the **Conditional rendering** tab in the column settings panel to define rules.

Example: only show the `director_bio` column when the `role` column equals `director`.

## Validation rules

The **Validation rules** tab lets you add constraints beyond the column type:

* **Required** — must not be empty
* **Pattern** — regex match
* **Min / Max** — range for numeric types
* **Min length / Max length** — character limits for text types

## Column permissions

The **Permissions** tab on each column lets you restrict read and write access per WordPress role. See [Permissions](/custom-content-types/permissions.md).
