Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-inline-center

ambar47.3kMIT1.0.3TypeScript support: included

Centering inline elements like magic

readme

react-inline-center

npm version minzipped size module

Centering inline elements like magic:

  • No need to add the wrapper element
  • The child element (image, icon etc.) can be any size
  • Only align to the first line of adjacent text

Install

npm install react-inline-center

Demo

Usage

import InlineCenter from 'react-inline-center'

render(
  <>
    <Button>
      <InlineCenter>
        <MyIcon />
      </InlineCenter>
      label.
    </Button>
    <p>
      <InlineCenter>
        <image />
      </InlineCenter>
      text.
    </p>
  </>
)