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.
- 🎯 One-click element outline visualization
- 🎨 Customizable outline color
- 🧹 Auto-cleanup on component unmount
- 📱 Responsive floating button
- 🔄 Toggle functionality
- 🎭 Built-in TypeScript support
npm install borderly
# or
yarn add borderly
# or
pnpm add borderly
- Import the Borderly component:
import Borderly from 'borderly';
- Add it to your React application:
function App() {
return (
<div>
<Borderly />
{/* Your other components */}
</div>
);
}
You can customize the outline color by passing the outlineColor
prop:
<Borderly outlineColor="#ff0000" />
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 |
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.
- React 16.8+ (Hooks support)
- TypeScript (optional but supported)
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.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT © [Abhay Chauhan]
If you encounter any issues or have questions, please file an issue on the GitHub repository.