mobile-text-category-slider
v1.0.2
Published
A responsive mobile category slider component for React
Maintainers
Readme
React Category Slider
A lightweight, responsive category slider component for React. Great for displaying horizontal lists like food categories, tags, or product filters.
✨ Features
- Pure React + CSS
- Horizontal scroll with hidden scrollbar
- Skeleton loading state (no external dependency)
- Mobile-friendly
- Easy to style and customize
📦 Installation
npm install mobile-text-category-slider
🧩 Props
| Prop | Type | Required | Description |
| --------------------- | -------------------------------- | -------- | ------------------------------------------------- |
| `categoryList` | `Category[]` | ✅ Yes | Array of category objects `{ id, category_name }`|
| `isSkeleton` | `boolean` | ❌ No | Show skeleton placeholders while loading |
| `handleCategoryClick` | `(id: string \| number) => void` | ✅ Yes | Callback when a category is clicked |
🚀 Usage
import { CategorySlider } from 'react-category-slider';
const categories = [
{ id: 1, category_name: 'Pizza' },
{ id: 2, category_name: 'Burgers' },
{ id: 3, category_name: 'Sushi' },
];
<CategorySlider
categoryList={categories}
isSkeleton={false}
handleCategoryClick={(id) => console.log('Clicked category:', id)}
/>
📐 Category Type
interface Category {
id: number;
category_name: string;
}
🎨 Styling
The component includes basic styles (CSS) out of the box.
You can override them in your own stylesheets as needed.
🔧 Development
This component was built using Vite and Tsup for building and bundling.
🙋♂️ Author
Made with ❤️ by Yasashri