Skip to content

Input psudo-elements inside of psudo-classes #116

Closed Answered by nmn
yonatan2703 asked this question in Q&A
Discussion options

You must be logged in to vote

The limitation here is that we don't yet support descendent and sibling selectors. We're working on a proposal to share to add this feature soon.

In the meantime, as a workaround, you can make this work for now by using CSS variables.

1. Define a checkbox-tokens.stylex.ts file:

export const afterVals = stylex.defineVars({
  content: '" "',
  display: 'inline-block',
  //...
});

2. Import and the variables:

import {afterVals} from './checkbox-tokens.stylex';
const styles = stylex.create({
  checkbox: {
    [afterVals.content]: {
      default: '" "',
      ':focus': 'url("/icons/check.svg")',
    },
    [afterVals.display]: {
      default: 'inline-block',
      ':focus': 'flex',
    },
    

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@lifeiscontent
Comment options

@nmn
Comment options

nmn Sep 4, 2024
Collaborator

Answer selected by nmn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants