← Back

Text Align Center

Install

npm install @svg-animated-icons/react

CLI

Copy an icon component straight into your project — shadcn-style. Replace {icon} with an icon name like arrow-left.

terminal
npx @svg-animated-icons/cli add {icon} --react
FlagDescription
--dest <dir>Destination directory (default: components/animated-icons)

Or copy the component with the CLI

CLI
npx @svg-animated-icons/cli add text-align-center --react

Code

React
// Generated by @svg-animated-icons/cli
// You own this file — edit it freely.

import React from "react";

type Props = {
  disableHover?: boolean;
  className?: string;
};

export function TextAlignCenterIcon({ disableHover, className }: Props) {
  const classes = [
    "ai-text-align-center-icon",
    disableHover ? "no-hover" : "",
    className ?? "",
  ]
    .filter(Boolean)
    .join(" ");

  return (
    <>
      <style>{`
.ai-text-align-center-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  cursor: pointer;
  overflow: visible;
}

.ai-text-align-center-icon * {
  transform-box: fill-box;
}

.ai-text-align-center-icon.no-hover * {
  transform: none;
  opacity: 1;
  animation: none;
}

.ai-text-align-center-icon .lines {
  transform-box: view-box;
  transform-origin: 7.5px 7.5px;
}

.ai-text-align-center-icon:not(.no-hover):hover .lines {
  animation: ai-text-align-center-center 700ms ease-in-out;
}

@keyframes ai-text-align-center-center {
  0%, 100% { transform: scaleX(1); }
  50% { transform: scaleX(0.85); }
}
`}</style>
      <svg
        xmlns="http://www.w3.org/2000/svg"
        className={classes}
        viewBox="0 0 15 15"
        fill="none"
      >
        <path className="lines" d="M11.5 10C11.7761 10 12 10.2239 12 10.5C12 10.7761 11.7761 11 11.5 11H3.5C3.22386 11 3 10.7761 3 10.5C3 10.2239 3.22386 10 3.5 10H11.5ZM10.5 7C10.7761 7 11 7.22386 11 7.5C11 7.77614 10.7761 8 10.5 8H4.5C4.22386 8 4 7.77614 4 7.5C4 7.22386 4.22386 7 4.5 7H10.5ZM12.5 4C12.7761 4 13 4.22386 13 4.5C13 4.77614 12.7761 5 12.5 5H2.5C2.22386 5 2 4.77614 2 4.5C2 4.22386 2.22386 4 2.5 4H12.5Z" fill="currentColor"/>
      </svg>
    </>
  );
}