borderly v1.0.4
Borderly
A lightweight React component that helps you visualize and debug your layout by adding outlines to all elements on your page with a single click.
Features
- ๐ฏ One-click element outline visualization
- ๐จ Customizable outline color
- ๐งน Auto-cleanup on component unmount
- ๐ฑ Responsive floating button
- ๐ Toggle functionality
- ๐ญ Built-in TypeScript support
Installation
npm install borderly
# or
yarn add borderly
# or
pnpm add borderly
Usage
- Import the Borderly component:
import Borderly from 'borderly';
- Add it to your React application:
function App() {
return (
<div>
<Borderly />
{/* Your other components */}
</div>
);
}
Customizing the outline color
You can customize the outline color by passing the outlineColor
prop:
<Borderly outlineColor="#ff0000" />
Props
Prop | Type | Default | Description |
---|---|---|---|
outlineColor | string | "tomato" | The color of the outline applied to elements |
outlineColor | string | "yellow" | The color of the outline applied to elements |
outlineColor | string | "green" | The color of the outline applied to elements |
outlineColor | string | "red" | The color of the outline applied to elements |
How It Works
Borderly adds a floating button to your application that, when clicked, dynamically injects a style element into your document's head. This style element adds a 1px solid outline to all elements on the page, making it easy to visualize your layout structure.
The outline can be toggled on and off with the button, and the style element is automatically cleaned up when the component unmounts.
Requirements
- React 16.8+ (Hooks support)
- TypeScript (optional but supported)
Styling
Borderly uses Tailwind CSS classes for styling the toggle button. If you're not using Tailwind in your project, make sure to include the necessary styles or override them using your own CSS.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT ยฉ Abhay Chauhan
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.