Styling fields on edit screens
CAFE fields on posts, pages, custom post types and terms use their own
stylesheet (assets/build/fields.css). Every color, radius and spacing in it
comes from a CSS custom property, so you can change the look without
rewriting any rules.
1. Appearance settings (no code)
CAFE → Settings → Appearance sets the main values for the whole site:
| Setting | Variable | Default |
|---|---|---|
| Accent color | --cafe-accent |
#4f46e5 |
| Field background | --cafe-field-bg |
#ffffff |
| Sub-field background | --cafe-subfield-bg |
#f8fafc |
| Font color | --cafe-text |
#1e293b |
| Border color | --cafe-border |
#e2e8f0 |
| Header background (automatic or custom) | --cafe-header-bg |
automatic: a light tint of the accent |
| Header font color | --cafe-header-text |
#1e293b (also the move / collapse arrows and the edit cog in the header) |
| Corners (rounded / square) | --cafe-radius |
10px / 2px |
| Add buttons: background, font color, hover background, hover font color | --cafe-add-bg, --cafe-add-text, --cafe-add-hover-bg, --cafe-add-hover-text |
automatic (not set): a light button with an accent outline and accent text, a soft accent on hover. Used by the "Add Item" / "Add Section" buttons of Collections and Section Builders |
| Top line (show / hide) | --cafe-box-top |
show: 3px solid in the accent color along the top of field boxes; hide: not set, the box keeps its 1px border |
| Density (comfortable / compact) | --cafe-gap |
16px / 10px |
| Tab style (underline / boxed / pills / structured) | --cafe-tab-bar-pad, --cafe-tab-gap, --cafe-tab-radius, --cafe-tab-line-size, --cafe-tab-join, --cafe-tab-divider, --cafe-tab-side-pad, --cafe-tab-side-radius, --cafe-tab-side-line |
underline: the stylesheet defaults (tabs on a line with space above them, an accent line under (or beside) the open tab); boxed: blocks with 1px lines between them, no spacing or corners, the open tab joins its fields; pills: tabs with space around them, no line, the open one filled; structured: tabs edge to edge with fine lines between them (--cafe-tab-rule), a field count on each tab (--cafe-tab-count), the open tab joining its fields with an accent bar on top (--cafe-tab-line-dir: 1, 3px) or on the left with an arrow (--cafe-tab-arrow), and a soft shadow along the side column (--cafe-tab-edge). A red dot marks a tab whose fields have an error, in every style |
| Tab corners (square / rounded) | --cafe-tab-radius, --cafe-tab-side-pad, --cafe-tab-side-gap, --cafe-tab-side-radius, --cafe-tab-side-join |
square (default): flat tabs, side tabs fill the column edge to edge and the open one covers the column line; rounded: rounded tabs (60% of the corner radius), side tabs with 10px around them. Boxed is always square |
| Tab size (small / medium / large) | --cafe-tab-pad-y, --cafe-tab-pad-x, --cafe-tab-font |
medium: 9px, 16px, 13px; small: 6px, 12px, 12px; large: 12px, 20px, 14px |
| Normal tab bar background (automatic or custom) | --cafe-tab-bg |
automatic: the sub-field background |
| Normal tab font color | --cafe-tab-text |
#64748b |
| Hover background (automatic or custom) | --cafe-tab-hover-bg |
automatic: a 6% tint of the text color |
| Hover font color (automatic or custom) | --cafe-tab-hover-text |
automatic: the text color |
| Open tab background (automatic or custom) | --cafe-tab-active-bg |
automatic: none (underline) / the field background (boxed) / the soft accent (pills) |
| Open tab font color (automatic or custom) | --cafe-tab-active-text |
automatic: the accent color |
| Open tab line color (automatic or custom) | --cafe-tab-indicator |
automatic: the accent color (underline); none (boxed) unless chosen; pills have no line |
| Tab border color (automatic or custom) | --cafe-tab-border |
automatic: the border color |
A field group can also have its own Box color (group settings). It adds a colored top border to the meta box and uses that color as the accent inside it.
2. Override variables with CSS
All other variables have defaults on :root. Override them in any admin
stylesheet, or with the cafe_edit_screen_css filter:
add_filter( 'cafe_edit_screen_css', function ( string $css ) {
return $css . '
:root { --cafe-input-height: 42px; --cafe-label-size: 14px; }
.cafe-scope { --cafe-input-radius: 4px; }
';
} );
| Variable | What it changes | Default |
|---|---|---|
--cafe-muted |
Instructions and hints | #64748b |
--cafe-input-border |
Input borders | #cbd5e1 |
--cafe-input-bg |
Input background | #ffffff |
--cafe-input-height |
Height of one-line inputs | 38px |
--cafe-input-radius |
Input corners | 60% of --cafe-radius |
--cafe-label-size |
Label font size | 13px |
--cafe-label-weight |
Label font weight | 600 |
--cafe-danger |
Required star, errors, remove buttons | #dc2626 |
--cafe-accent-soft |
Tinted backgrounds (active tab, box header) | 10% accent |
--cafe-focus-ring |
Focus shadow | 22% accent |
--cafe-input-radius, --cafe-accent-soft and --cafe-focus-ring are derived
from other variables on .cafe-scope. To change them, set them on .cafe-scope
(or a more specific selector), not on :root.
Useful selectors
| Selector | Element |
|---|---|
.postbox[id^="cafe-group-"] |
Every CAFE meta box |
#cafe-group-{key} |
One field group's meta box |
.cafe-scope |
Any CAFE field area (meta box, term form) |
.cafe-field--{type} |
Fields of one type, e.g. .cafe-field--rich_text |
.cafe-field.has-error |
A field with a validation error |
.cafe-tabs, .cafe-collapsible, .cafe-fieldset |
Layout fields |
.cafe-rows, .cafe-row |
Collection and Section Builder items |
.cafe-term-group |
A field group on a term screen |
Example: give one group a green accent and square inputs.
#cafe-group-group_hero {
--cafe-accent: #16a34a;
--cafe-input-radius: 0;
}
The class names and variables listed here are part of CAFE's public surface and are kept stable between minor versions.