---
title: Conditional Styles
description: "Yamada UI provides features to apply styles according to conditions."
---
## Overview
By using conditional styles, you can apply styles for [pseudo-elements](https://yamada-ui.com/docs/styling/style-props.md#pseudo-elements), [pseudo-classes](https://yamada-ui.com/docs/styling/style-props.md#pseudo-classes), and [selectors](https://yamada-ui.com/docs/styling/style-props.md#selectors).
## Pseudo Elements
To apply styles to the `::before` pseudo-element, use `_before`.
```tsx
Box
```
:::note
Available pseudo-elements are [here](https://yamada-ui.com/docs/styling/style-props.md#pseudo-elements).
:::
## Pseudo Classes
To apply styles to the `:hover` pseudo-class, use `_hover`.
```tsx
Hover me
```
You can also apply multiple values together.
```tsx
Hover me
```
You can also combine multiple conditions.
```tsx
Hover and focus me
```
:::note
Available pseudo-classes are [here](https://yamada-ui.com/docs/styling/style-props.md#pseudo-classes).
:::
## Selectors
To apply styles based on the `data-orientation` attribute, use `_horizontal` or `_vertical`.
```tsx
horizontal
```
:::note
Available selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors).
:::
### Group Selectors
To apply styles to an element based on the state or attribute of the parent element, add the `"group"` or `"data-group"` role to the parent element and use the `_group*` conditional styles for the child elements.
```tsx
Hover me
```
:::note
Available group selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors).
:::
### Peer Selectors
To apply styles to an element based on the state or attribute of the peer element, add the `data-peer` to the peer element and use the `_peer*` conditional styles.
```tsx
Focus the peer
Focus me!
```
:::note
Available peer selectors are [here](https://yamada-ui.com/docs/styling/style-props.md#selectors).
:::
### Any Selectors
To use any selectors, use `css` to apply styles.
```tsx
Closed
```