pub enum VariantType {
PseudoElement(&'static str),
PseudoClass(&'static str),
WrapClass(Cow<'static, str>),
AtRule(Cow<'static, str>),
Group(&'static str),
Peer(&'static str),
PeerNot(&'static str),
}Expand description
Structure used to add pseudo-selectors, pseudo-elements, pseudo classes and media queries to CSS rules.
Variant are useful to conditionally apply utility classes.
See config::BUILTIN_VARIANTS for a list of all default variants.
See Tailwind’s documentation to learn more about variants.
Variants§
PseudoElement(&'static str)
A CSS pseudo element.
§Example
If the variant is VariantType::PseudoClass("before") and the original class is ".bg-red-500", the class will become ".bg-red-500::before").
PseudoClass(&'static str)
A CSS pseudo class.
§Example
If the variant is VariantType::PseudoClass("hover") and the original class is ".bg-red-500", the class will become ".bg-red-500:hover").
WrapClass(Cow<'static, str>)
Wrap the original class to make another one.
§Example
If the variant is VariantType::WrapClass("&[open]") and the original class is ".bg-red-500", the class will become ".bg-red-500[open]").
AtRule(Cow<'static, str>)
Add a @ CSS rule (like @media, @supports).
§Example
If the variant is VariantType::AtRule("@media (orientation: portrait)") and the original
class is ".bg-red-500", the class will become "@media (orientation: portrait) { .bg-red-500 { ... } }").
Group(&'static str)
A variant applied to a group element like group-hover.
This variant should not be built manually.
Peer(&'static str)
A variant applied to a peer element like peer-focus.
This variant should not be built manually.
PeerNot(&'static str)
A negated variant applied to a peer element like peer-not-hover.
This variant should not be built manually.
Trait Implementations§
Source§impl Clone for VariantType
impl Clone for VariantType
Source§fn clone(&self) -> VariantType
fn clone(&self) -> VariantType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for VariantType
impl Debug for VariantType
Source§impl PartialEq for VariantType
impl PartialEq for VariantType
impl Eq for VariantType
impl StructuralPartialEq for VariantType
Auto Trait Implementations§
impl Freeze for VariantType
impl RefUnwindSafe for VariantType
impl Send for VariantType
impl Sync for VariantType
impl Unpin for VariantType
impl UnwindSafe for VariantType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.