A lightweight React component library featuring a Higher Order Component (HOC) for conditional rendering. Like Vue.js's v-show directive.
- 🎯 ConditionalShow HOC for dynamic component visibility
- ⚛️ TypeScript support with full type definitions
- 🔄 Easy integration with existing React components
- 🛠️ Built-in CloseButton component example
- 📦 Zero dependencies
- 🔨 Vite powered build system
- 🎨 Code formatting with Biome
- 🚀 GitHub Packages ready
- 🪝 Git hooks with Husky
The library's main feature is the ConditionalShow
HOC that enables conditional rendering of components using the r-show
prop, similar to Vue.js's v-show directive (yes this is a vue js copy).
pnpm install @santosl2/react-conditional-show
# Start dev server
pnpm dev
# Build library
pnpm build
The library exports components that can be imported and used in React applications:
import { ConditionalShow } from 'react-component-lib-template'
// Use conditional rendering
const MyComponent = ConditionalShow(BaseComponent)
// Example with CloseButton
const { CloseButton } = ConditionalShow
<CloseButton r-show={showButton} />
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
Please make sure to update tests as appropriate and follow the existing code style.
MIT