An Interest In:
Web News this Week
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
- April 12, 2024
April 18, 2024 05:40 pm GMT
Original Link: https://dev.to/_estheradebayo/panda-css-conditions-4fl5
Panda CSS Conditions
Conditions in Panda allow you to change styles depending on specific states or situations.
For example, if I want to style an SVG element specifically, I can create a condition in the Panda config file.
import { defineConfig } from '@pandacss/dev'export default defineConfig({ conditions: { extend: { icon: "& > svg" }, },});
To use this condition, I prefix it with an underscore.
function App() { return ( <div className={css({ _icon: { color: '#CDCDCD', }, })} > Conditions in Panda </div> );}
This tells Panda only to apply that style when that specific condition is true.
Learn more about Panda CSS with my crash course
.
Original Link: https://dev.to/_estheradebayo/panda-css-conditions-4fl5
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To