
Security News
TC39 Advances 11 Proposals for Math Precision, Binary APIs, and More
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
react-custom-kanban-board
Advanced tools
A customizable Kanban board component for React with advanced features like search, filtering, and WIP limits.
A flexible and customizable Kanban board component for applications. The KanbanBoard
component allows you to create interactive and draggable task cards organized into columns, making it ideal for project management and task tracking.
Here are some visual examples of the Kanban board component:
Install the KanbanBoard
component via NPM:
npm install react-custom-kanban-board
or using yarn:
yarn add react-custom-kanban-board
Import and use the Kanban board in your React project:
import React from "react";
import KanbanBoard from "react-custom-kanban-board";
const columns = [
{ title: "To Do", key: "todo", color: "#BDBDCD" },
{ title: "In Progress", key: "in-progress", color: "#FDDDE3" },
{ title: "Done", key: "done", color: "#71C781" },
];
const initialCards = [
{
id: "1",
title: "Task 1",
status: "todo",
avatarPath: "https://i.pravatar.cc/40?img=1",
},
{
id: "2",
title: "Task 2",
status: "in-progress",
avatarPath: "https://i.pravatar.cc/40?img=2",
},
];
const App = () => {
return (
<div>
<h1>My Kanban Board</h1>
<KanbanBoard
columns={columns}
initialCards={initialCards}
columnForAddCard="todo"
/>
</div>
);
};
export default App;
Here's how to integrate the Kanban board with Chakra UI for enhanced UI components:
import React, { useState, useEffect, useRef } from "react";
import KanbanBoard from "react-custom-kanban-board";
import {
ChakraProvider,
InputGroup,
Input,
InputLeftElement,
InputRightElement,
IconButton,
Box,
Text,
Menu,
MenuButton,
MenuList,
MenuItem,
Button,
Divider,
extendTheme,
} from "@chakra-ui/react";
import { SearchIcon, ChevronDownIcon, CloseIcon } from "@chakra-ui/icons";
import "./App.css";
// Create a theme
const theme = extendTheme({
// Your theme customizations here (optional)
});
const App = () => {
// Sample columns with WIP limits
const columns = [
{ title: "To Do", key: "todo", color: "#B8C2CC" },
{ title: "In Progress", key: "in-progress", color: "#FFB1C1", limit: 3 }, // WIP limit
{ title: "Review", key: "review", color: "#FFD580" },
{ title: "Done", key: "done", color: "#91D18B" },
];
// Sample cards data
const initialCards = [
{
id: "1",
title: "Create user authentication flow",
status: "todo",
avatarPath: "https://i.pravatar.cc/40?img=1",
priority: "High",
dueDate: "2023-06-30",
tags: ["frontend", "auth"],
description:
"Implement user registration, login, and password reset flows.",
assignee: "john",
},
// ... more cards
];
// Filter configurations
const filterConfigs = [
{
field: "priority",
label: "Priority",
options: [
{ value: "High", label: "High Priority" },
{ value: "Medium", label: "Medium Priority" },
{ value: "Low", label: "Low Priority" },
],
},
// ... more filter configs
];
const [cards, setCards] = useState(initialCards);
const [loading, setLoading] = useState(true);
// Simulate loading data
useEffect(() => {
setTimeout(() => {
setLoading(false);
}, 1500);
}, []);
// Custom Search Input Component using Chakra UI
const CustomSearchInput = ({ searchTerm, setSearchTerm }) => {
const inputRef = useRef(null);
return (
<InputGroup size="md" maxW="400px">
<InputLeftElement pointerEvents="none">
<SearchIcon color="gray.400" />
</InputLeftElement>
<Input
ref={inputRef}
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
placeholder="Find tasks..."
borderRadius="full"
bg="white"
borderColor="gray.300"
/>
{searchTerm && (
<InputRightElement>
<IconButton
size="sm"
variant="ghost"
icon={<CloseIcon w={3} h={3} />}
onClick={() => {
setSearchTerm("");
inputRef.current?.focus();
}}
aria-label="Clear search"
/>
</InputRightElement>
)}
</InputGroup>
);
};
// Custom Filter Menu Component using Chakra UI
const CustomFilterMenu = ({ config, selectedValue, onChange }) => {
const selectedOption = config.options.find(
(opt) => opt.value === selectedValue
);
const displayValue = selectedOption
? selectedOption.label
: `All ${config.label}s`;
return (
<Box mx={2}>
<Text fontSize="xs" color="gray.500" mb={1}>
{config.label}
</Text>
<Menu closeOnSelect={true}>
<MenuButton
as={Button}
rightIcon={<ChevronDownIcon />}
size="sm"
variant="outline"
w="160px"
>
{displayValue}
</MenuButton>
<MenuList zIndex={100}>
<MenuItem
onClick={() => onChange(config.field, null)}
fontWeight={!selectedValue ? "bold" : "normal"}
>
All {config.label}s
</MenuItem>
<Divider />
{config.options.map((option) => (
<MenuItem
key={option.value}
onClick={() => onChange(config.field, option.value)}
fontWeight={selectedValue === option.value ? "bold" : "normal"}
>
{option.label}
</MenuItem>
))}
</MenuList>
</Menu>
</Box>
);
};
// Wrapper functions to match the expected function signature
const customSearchWrapper = (searchTerm, setSearchTerm) => {
return (
<CustomSearchInput
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
/>
);
};
const customFilterWrapper = (config, selectedValue, onChange) => {
return (
<CustomFilterMenu
config={config}
selectedValue={selectedValue}
onChange={onChange}
/>
);
};
return (
<ChakraProvider theme={theme}>
<div className="app-container">
<header className="app-header">
<h1>Project Task Board</h1>
</header>
<main className="board-container">
<KanbanBoard
columns={columns}
initialCards={cards}
columnForAddCard="todo"
isLoading={loading}
emptyColumnMessage="No tasks yet"
enableSearch={true}
enableFiltering={true}
filterConfigs={filterConfigs}
renderSearchInput={customSearchWrapper}
renderFilterMenu={customFilterWrapper}
/>
</main>
</div>
</ChakraProvider>
);
};
export default App;
Prop | Type | Default | Description |
---|---|---|---|
columns | Column[] | [] | Array of columns to display. Each object should include title , key , and color . |
initialCards | Card[] | [] | Array of cards to display initially. Each object should include id , title , status , and optionally avatarPath . |
columnForAddCard | string | - | Key of the column where new cards will be added. |
onCardMove | (cardId: string, newStatus: string) => void | - | Callback function when a card is moved. |
onCardEdit | (cardId: string, newTitle: string) => void | - | Callback function when a card is edited. |
onCardDelete | (cardId: string) => void | - | Callback function when a card is deleted. |
onTaskAddedCallback | (title: string) => void | - | Callback function when a new task is added. |
renderCard | (card: Card, handleDragStart: (e: React.DragEvent<HTMLDivElement>, card: Card) => void, isExpanded?: boolean, toggleExpand?: (id: string) => void) => ReactNode | - | Custom function to render cards. |
renderAvatar | (avatarPath?: string) => ReactNode | - | Custom function to render avatars. |
renderAddCard | (column: string, setCards: React.Dispatch<React.SetStateAction<Card[]>>) => ReactNode | - | Custom function to render the add card button. |
isLoading | boolean | false | Shows loading spinner when true. |
loadingComponent | ReactNode | - | Custom loading component. |
emptyColumnMessage | string | "No cards yet" | Message to display when a column is empty. |
enableSearch | boolean | false | Enable search functionality. |
enableFiltering | boolean | false | Enable filtering functionality. |
filterConfigs | FilterConfig[] | [] | Configuration for filters. |
onFilterChange | (filters: Record<string, string | null>) => void | - | Callback when filters change. |
renderSearchInput | (searchTerm: string, setSearchTerm: (term: string) => void) => ReactNode | - | Custom function to render search input. |
renderFilterMenu | (config: FilterConfig, value: string | null, handleFilterChange: (field: string, value: string | null) => void) => ReactNode | - | Custom function to render filter menu. |
Property | Type | Description |
---|---|---|
title | string | Title of the column. |
key | string | Unique key for the column. |
color | string | Background color for the column. |
limit | number | Optional WIP limit for the column. |
Property | Type | Description |
---|---|---|
id | string | Unique identifier for the card. |
title | string | Title of the card. |
status | string | Status of the card, corresponds to column key. |
avatarPath | string | URL to the avatar image. |
priority | string | Priority level (e.g., "High", "Medium", "Low"). |
dueDate | string | Due date for the card. |
tags | string[] | Array of tags for the card. |
description | string | Detailed description of the card. |
assignee | string | Person assigned to the card. |
[key: string] | any | Any additional custom properties you need. |
Property | Type | Description |
---|---|---|
field | string | Field to filter by (e.g., "priority", "assignee"). |
label | string | Display label for the filter. |
options | FilterOption[] | Array of available filter options. |
Property | Type | Description |
---|---|---|
value | string | Value of the filter option. |
label | string | Display label for the filter option. |
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For any questions or issues, please contact HamdyIIbarhim.
FAQs
A customizable Kanban board component for React with advanced features like search, filtering, and WIP limits.
The npm package react-custom-kanban-board receives a total of 111 weekly downloads. As such, react-custom-kanban-board popularity was classified as not popular.
We found that react-custom-kanban-board demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.