Skip to content

Hook useStaticClassName(block, element, modifier)

Generates static class name using BEM notation

For more information about BEM, visit the official website.

Parameters

  • block
    • Type: string | undefined
  • element
    • Type: string | undefined
  • modifier
    • Type: string | string[] | undefined

Returns

  • Type: string | null

Example

tsx
import { useStaticClassName } from "@prozilla-os/core";

export function Example() {
	return <div className={useStaticClassName("Example")}>
		<h1 className={useStaticClassName("Example", "Title")}>This is a title</h1>
		<p className={useStaticClassName("Example", "Paragraph", "Special")}>This is a special paragraph</p>
	</div>;
}

Result

html
<div class="ProzillaOS-Example">
	<h1 class="ProzillaOS-Example__Title">This is a title</h1>
	<p class="ProzillaOS-Example__Paragraph--Special">This is a special paragraph</p>
</div>

Built by Prozilla