# Class names type safety

It's like [clsx](https://www.npmjs.com/package/clsx) but you can only pass it classes that are from the dsfr.

<figure><img src="/files/NzVU6UyzijGQq43hm1tb" alt=""><figcaption></figcaption></figure>

You can't apply your custom classes using fr.cx(), you'll get type error, but you can combine a regular `cx()` or `clsx()` function and `fr.cx()`. Example:

```tsx
import { useStyles } from "tss-react/dsfr";
import { fr } from "@codegouvfr/react-dsfr";  

type Params = {
    className?: string;
};

export function MyComponent(params: Params){

   const { className } = params;  
   
   const { cx } = useStyles();
   
   return (
       <div className={cx(fr.cx("fr-p-10v"), className)}>
           //...
       </div>
   );

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://react-dsfr.codegouv.studio/class-names-type-safety.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
