Skip to content
R

react-body-classname

A declarative, nested way to manipulate your body's className

by iestFree

#971in UI Libraries
0In stores

Description

react-body-classname is a small React helper for setting the class name on the document body from inside your components. Instead of changin…

Highlights

  • Declarative body class names from React components
  • Nested components can add their own classes
  • Server-side rendering with rewind()
  • Works with React 0.13 and later

Ratings & Reviews

No ratings yet

Be the first to rate react-body-classname.

People also visit

R

react-css-modules

Seamless mapping of class names to CSS modules inside of React components

UI Libraries
Launch
R

react-bem-helper

allows you to easily add BEM-style element and modifier classes

UI Libraries
Launch
R

react-document-title

A declarative, nested, stateful document.title for React

UI Libraries
Launch
S

style-it

Component for writing plaintext CSS in React apps -- isomorphic, scoped

UI Libraries
Launch
R

react-headroom

Hide your header until you need it. React.js port of headroom.js

UI Libraries
Launch
R

react-meta-tags

Handle document meta/head tags in isomorphic react with ease

UI Libraries
Launch

react-body-classname FAQ

What does react-body-classname do?

It sets document.body.className declaratively from React components, so each part of your tree can add the classes it needs.

How do I install it?

Install the react-body-classname package from npm. It needs React 0.13 or later.

Can it be used on the server?

Yes. Call BodyClassName.rewind() after rendering to a string, then put the combined class name into your HTML template.

What should I watch out for?

It supports only a single child in its props. On the server you must call rewind(), since the component tracks mounted instances and skipping it leaks memory.

Is it free?

The source is public on GitHub, which is where it is distributed.

What are the best react-body-classname alternatives?

Popular alternatives to react-body-classname include react-css-modules, react-bem-helper and react-document-title. See all react-body-classname alternatives

Developer Stuff

Badges