The Users table's columns: the standard user fields plus the enabled custom fields, with their metadata.
Each admin picks their own through PhoenixKitWeb.TableColumns
(columns_spec/0, view key "users"). The user_table_columns setting
this module also reads and writes is the site's default — what an admin
who has not chosen sees — not anyone's current choice. The Actions
column is always last and is not one of the columns an admin picks.
Summary
Functions
Checks if a column is required (cannot be hidden).
The spec PhoenixKitWeb.TableColumns needs for the Users table: every
standard and custom column (Actions is not one — it is always last), the
built-in defaults, and the site's default from user_table_columns.
Gets all available column IDs from both standard and custom fields.
Gets all available columns for the user table.
Gets metadata for a specific column.
Gets the default column configuration.
The site's default columns, Actions included, falling back to the
built-in default when the site has none. An admin's own choice is read
through PhoenixKitWeb.TableColumns (columns_spec/0).
Reorders columns based on user drag-and-drop interaction.
The site's default columns (without Actions), or nil when the site has
not set one.
Sets the site's default columns — what an admin who has not chosen their own sees. Actions is kept, last.
Validates a list of column IDs against available columns.
Functions
Checks if a column is required (cannot be hidden).
Examples
iex> PhoenixKit.Users.TableColumns.column_required?("email")
true
iex> PhoenixKit.Users.TableColumns.column_required?("username")
false
@spec columns_spec() :: map()
The spec PhoenixKitWeb.TableColumns needs for the Users table: every
standard and custom column (Actions is not one — it is always last), the
built-in defaults, and the site's default from user_table_columns.
Gets all available column IDs from both standard and custom fields.
Gets all available columns for the user table.
Returns a map combining standard columns with active custom fields. Each column includes metadata like label, field path, and rendering information.
Examples
iex> PhoenixKit.Users.TableColumns.get_available_columns()
%{
"email" => %{label: "Email", field: "email", required: true},
"username" => %{label: "Username", field: "username", required: false},
"custom_123" => %{label: "Department", field: "custom_data.department", field_id: 123, field_type: "select", required: false}
}
Gets metadata for a specific column.
Examples
iex> PhoenixKit.Users.TableColumns.get_column_metadata("email")
%{label: "Email", field: "email", required: true}
Gets the default column configuration.
Returns the list of columns that should be visible by default if no user preference is saved in settings.
The site's default columns, Actions included, falling back to the
built-in default when the site has none. An admin's own choice is read
through PhoenixKitWeb.TableColumns (columns_spec/0).
Examples
iex> PhoenixKit.Users.TableColumns.get_user_table_columns()
["email", "username", "role", "status", "registered"]
Reorders columns based on user drag-and-drop interaction.
Takes the new order from the frontend and ensures it's valid and complete. Actions column is always appended at the end.
Examples
iex> PhoenixKit.Users.TableColumns.reorder_columns(["username", "email"], ["email", "username", "actions"])
["username", "email", "actions"]
@spec site_columns() :: [String.t()] | nil
The site's default columns (without Actions), or nil when the site has
not set one.
Sets the site's default columns — what an admin who has not chosen their own sees. Actions is kept, last.
Examples
iex> PhoenixKit.Users.TableColumns.update_user_table_columns(["email", "role", "status"])
{:ok, %Setting{}}
Validates a list of column IDs against available columns.
Returns only the valid column IDs from the input list.
Examples
iex> PhoenixKit.Users.TableColumns.validate_columns(["email", "invalid_id", "role"])
["email", "role"]