219 words, 2 min read

By default, Element Plus displays the required asterisk before a form label, for example: *Name. While this is functional, some design systems prefer placing the asterisk after the label instead, like Name*. Fortunately, it’s easy to adjust this behavior using either a CSS override or a custom label slot.

If you want to apply this change throughout your app, you can hide the default prefix and append your own asterisk using CSS:

.el-form-item.is-required .el-form-item__label:before {
display: none;
}
.el-form-item.is-required .el-form-item__label:after {
content: '*';
color: var(--el-color-danger);
margin-left: 4px;
}

This snippet removes the default “before” pseudo-element and adds a red asterisk to the end of each required label. You can in…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help