Ability to assign custom class(es) to fields for enhanced theming capabilities #22321
formfcw
started this conversation in
Feature Requests
Replies: 1 comment
-
Great idea! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
This is a small improvement. As the title describes it, it would be useful to be able to assign class(es) to fields, so that we can style them individually for the item page.
Motivation
While working with Directus, I often found that I needed to change the default appearance of fields on the item page. So I wrote the Classified Group Interface extension. The extension is a group interface that renders custom classes to that group. This way we can apply custom CSS to fields, that are wrapped by the group.
Detailed Design
👉 When creating a field, users can add custom classes from the field tab.
👉 In the
Settings > Appearance > Custom CSS
field users can add the appropriate CSS.👉 On the item page, the field appears with the custom CSS, because the
.field
div also contains the custom classes.Requirements List
Must Have:
Drawbacks
I think this is a small improvement that could be very useful. The only drawback I can think of is that applied classes could somehow affect future changes: if a user uses a class that Directus will implement in the future. But as long as it is scoped, this won't be a problem.
Alternatives
Maybe the
field
tab is not the perfect place, because it should only affect fields on the item page – so interfaces and not displays.Adoption Strategy
Won’t break anything
Unresolved Questions
Is the
field
tab in the appearance settings the perfect place for the input field? (see above)Beta Was this translation helpful? Give feedback.
All reactions