Skip to main content

CloseEye Component

The CloseEye component in React is a visually descriptive SVG icon component, typically used to represent visibility control, such as hiding password input.

Features

  • Customizable dimensions and styling.
  • Represents a 'closed eye' icon, commonly used for toggling password visibility.
  • Scalable SVG for crisp rendering at any size.

Props

PropTypeDescription
colorstringColor of the icon.
widthnumberWidth of the icon (default is 24px).
heightnumberHeight of the icon (default is 24px).
classNamestringAdditional CSS classes for styling.

Component

import React from "react";

const CloseEye = ({ className, width = 24, height = 24 }: Props) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
fill="none"
width={width}
height={height}
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
className={`icon eye-open-icon ${className}`}
>
{/* SVG paths */}
</svg>
);
};

export default CloseEye;

Usage

This component is ideal for use in forms, particularly for password fields where the user can toggle the visibility of their password.

Example Usage

import CloseEye from "./path/to/CloseEye";

const PasswordInput = () => {
return (
<div>
<input type="password" />
<button>
<CloseEye className="text-gray-500" />
</button>
</div>
);
};

Styling

  • The icon can be styled with CSS using the className prop.
  • The width and height props allow for easy scaling to fit various UI layouts.

Notes

  • The color prop is mentioned in the type definition but is not implemented in the component. To use it, uncomment the stroke={color} in the SVG tag.
  • Ensure the icon's styling is consistent with your application's design language.

This documentation provides an overview of the CloseEye component, detailing its features, usage, and styling options. Adapt the component as needed for your specific project requirements.