textarea column type

Shows as multiline edit in edit/insert dialog
This commit is contained in:
Simon Willison 2026-06-13 22:18:45 -07:00
commit 5490c7b794
6 changed files with 29 additions and 8 deletions

View file

@ -1102,9 +1102,9 @@ These configure :ref:`full-text search <full_text_search>` for a table or view.
``column_types``
^^^^^^^^^^^^^^^^
You can assign semantic column types to columns, which affect how values are rendered, validated, and transformed. Built-in column types include ``url``, ``email``, and ``json``. Plugins can register additional column types using the :ref:`register_column_types <plugin_register_column_types>` plugin hook.
You can assign semantic column types to columns, which affect how values are rendered, validated, transformed, and edited. Built-in column types include ``url``, ``email``, ``json``, and ``textarea``. Plugins can register additional column types using the :ref:`register_column_types <plugin_register_column_types>` plugin hook.
Column types can optionally declare which SQLite column types they apply to using ``sqlite_types``. Datasette will reject incompatible assignments. The built-in ``url``, ``email``, and ``json`` column types are all restricted to ``TEXT`` columns.
Column types can optionally declare which SQLite column types they apply to using ``sqlite_types``. Datasette will reject incompatible assignments. The built-in ``url``, ``email``, ``json``, and ``textarea`` column types are all restricted to ``TEXT`` columns.
The simplest form maps column names to type name strings:
@ -1119,6 +1119,7 @@ The simplest form maps column names to type name strings:
website: url
contact: email
extra_data: json
notes: textarea
""").strip()
)
.. ]]]
@ -1135,6 +1136,7 @@ The simplest form maps column names to type name strings:
website: url
contact: email
extra_data: json
notes: textarea
.. tab:: datasette.json
@ -1148,7 +1150,8 @@ The simplest form maps column names to type name strings:
"column_types": {
"website": "url",
"contact": "email",
"extra_data": "json"
"extra_data": "json",
"notes": "textarea"
}
}
}

View file

@ -1092,7 +1092,7 @@ Column types are assigned to columns via the :ref:`column_types <table_configura
config:
format: rgb
Datasette includes three built-in column types: ``url``, ``email``, and ``json``.
Datasette includes four built-in column types: ``url``, ``email``, ``json``, and ``textarea``. The ``textarea`` type is an editing hint that causes Datasette's insert/edit forms to use a multiline ``<textarea>`` control for that column.
.. _plugin_asgi_wrapper: