Initial commit

This commit is contained in:
Igor Martyniuk
2026-06-25 15:53:49 +03:00
commit 1bb0b7e68a
1517 changed files with 218469 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
# useBodyClass
Adds one or more CSS classes to `document.body` while the component is mounted, and removes them on unmount.
## Signature
```ts
function useBodyClass(className: string): void;
```
| Parameter | Type | Description |
| ----------- | -------- | ------------------------------------------------------- |
| `className` | `string` | Space-separated class name(s) to add to `document.body` |
## Usage
```tsx
export function ModalLayout({ children }: { children: React.ReactNode }) {
useBodyClass('overflow-hidden bg-overlay');
return <div>{children}</div>;
}
```
While `ModalLayout` is mounted, `document.body` will have the classes `overflow-hidden` and `bg-overlay`. Both are removed automatically when the component unmounts.
## Notes
- Accepts a space-separated string — multiple classes are handled individually so partial removal is safe.
- Re-applies classes if the `className` prop changes.
- Client-only (`'use client'`). Does not run during SSR.