Skip to main content

OpenEye Component

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

Features

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

Props

PropTypeDescription
colorstringColor of the icon. Default is #000000.
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 OpenEye = ({
color = "#000000",
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}
stroke={color}
strokeWidth="1"
strokeLinecap="round"
strokeLinejoin="round"
className={`icon eye-open-icon ${className}`}
>
{/* SVG paths */}
</svg>
);
};

export default OpenEye;

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 OpenEye from "./path/to/OpenEye";

const PasswordInput = () => {
return (
<div>
<input type="password" />
<button>
<OpenEye 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 allows customization of the icon's stroke color.
  • Ensure the icon's styling is consistent with your application's design language.

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