css @apply input
is not the same as the input
class
#4046
-
hi, i wanted to create a custom .my_input {
@apply input
} rsx!(
label { class: "my_input",
span { class: "label", "{props.label}" }
input {
placeholder: "{props.placeholder}",
value: "{props.value}",
r#type: "text",
oninput: move |event| props.value.set(event.value()),
}
}
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Tailwind CSS
To extend styles, use something like Let me know if you have any questions |
Beta Was this translation helpful? Give feedback.
Tailwind CSS
@apply
only extends simple selectors. A class name like.input
has relative selectors (like child selector, sibling selector, etc) which is ignored by Tailwind's@apply
because it will easily create loops or will generate lots of unused styles.@apply
should be used for simple selectors that apply one or two CSS attributes to a single CSS class name. For example@apply p-4 bg-primary
. A component class name like.input
sets multiple CSS properties to multiple selectors.To extend styles, use something like
class="input my_input"
where.my_input
includes the modifications.Let me know if you have any questions