Skip to content

Variable: STATE_PREFIX ​

ts
const STATE_PREFIX: Regex<"(?<prefix>is|has|can|should|was)-(?<name>[A-Za-z_][\\w-]*)", {
  flags: "u";
  names: {
     name: string;
     prefix: string;
  };
}>;

Defined in: packages/regex/src/tiers/cssdoc-local.ts:321

State Prefix Pattern Matches common state prefixes used in conventions. Default prefixes: is-, has-, can-, should-, was- Pattern: prefix followed by state name.

Example ​

ts
STATE_PREFIX.exec("is-open")?.groups // { prefix: "is", name: "open" }
STATE_PREFIX.exec("has-focus")?.groups // { prefix: "has", name: "focus" }

Released under the MIT License