π¨ Customization & Styling
The TheaterSeatSelect component is highly customizable. You can style seats, rows, and entire sections using the customStyles prop.
You can also replace built-in UI parts like the screen and legend with your own components.
πΉ customStyles for Section-Level Stylingβ
The customStyles prop accepts an array of objects, where each object corresponds to one section in your SeatConfig.
This means you can give different looks to each section (e.g., VIP seats gold-colored, Balcony seats blue-colored).
Note: If the customStyles array size is smaller than the number of sections, the last style object in the array will be applied to all remaining sections automatically.
π Properties of SectionStyleβ
Each section style supports these keys:
rowGapβ Vertical spacing between rows.columnGapβ Horizontal spacing between seats in a row.headerStylesβ Styles for the section header (title).seatStylesβ Base styles for all seats in the section.- State-specific styles:
availableStylesβ Seats available for booking.bookedStylesβ Already booked seats.reservedStylesβ Temporarily held/reserved seats.disabledStylesβ Seats not available for selection (e.g., blocked for maintenance).selectedStylesβ Seats chosen by the current user.
β¨ Example: Styling Multiple Sectionsβ
function Example() { const seatConfig = [ { title: "VIP", seats: { A: [{ id: "A1" }, { id: "A2" }], B: [{ id: "B1" }, { id: "B2" }] } }, { title: "Balcony", seats: { C: [{ id: "C1" }, { id: "C2" }], D: [{ id: "D1" }, { id: "D2" }] } } ]; const customStyles = [ { rowGap: "20px", columnGap: "14px", headerStyles: { fontSize: "22px", fontWeight: "bold", color: "goldenrod" }, seatStyles: { borderRadius: "8px", width: "50px", height: "50px" }, availableStyles: { backgroundColor: "#fff4d6", border: "2px solid goldenrod" }, bookedStyles: { backgroundColor: "#bfbfbf", color: "#fff" }, reservedStyles: { backgroundColor: "#ff9800", color: "#fff" }, disabledStyles: { backgroundColor: "#f5f5f5", color: "#ccc" }, selectedStyles: { backgroundColor: "#ffd700", color: "#000" } }, { rowGap: "12px", columnGap: "8px", headerStyles: { fontSize: "18px", fontWeight: "600", color: "#3f51b5" }, seatStyles: { borderRadius: "4px", width: "40px", height: "40px" }, availableStyles: { backgroundColor: "#e3f2fd", border: "1px solid #3f51b5" }, bookedStyles: { backgroundColor: "#9e9e9e", color: "#fff" }, reservedStyles: { backgroundColor: "#ff5722", color: "#fff" }, disabledStyles: { backgroundColor: "#eeeeee", color: "#999" }, selectedStyles: { backgroundColor: "#3f51b5", color: "#fff" } } ]; return <TheaterSeatSelect config={seatConfig} customStyles={customStyles} /> }
β Here,
- The VIP section has gold-themed seats with larger dimensions.
- The Balcony section has smaller, blue-themed seats with tighter spacing.
πΉ Row & Column Spacingβ
You can control spacing independently for each section:
rowGapβ Adds vertical space between rows.columnGapβ Adds horizontal space between seats in a row.
Example:
const customStyles = [
{
rowGap: "24px", // More space between rows
columnGap: "16px" // Wider spacing between seats
}
];
πΉ Seat Styling by Stateβ
Each seat state can be styled separately:
- Available β Neutral background (default state).
- Booked β Typically red or grey (indicating not selectable).
- Reserved β Orange/yellow (held temporarily).
- Disabled β Greyed out (permanently unavailable).
- Selected β Green/blue (highlighting userβs choice).
Example:
const customStyles = [
{
seatStyles: { borderRadius: "6px", width: "42px", height: "42px" },
availableStyles: { backgroundColor: "#fafafa", border: "1px solid #ddd" },
bookedStyles: { backgroundColor: "#e53935", color: "#fff" },
reservedStyles: { backgroundColor: "#fbc02d", color: "#000" },
disabledStyles: { backgroundColor: "#cfd8dc", color: "#757575" },
selectedStyles: { backgroundColor: "#4caf50", color: "#fff" }
}
];
β
Best Practices for customStyles
- Keep seat dimensions consistent within a section for proper alignment.
- Use contrasting colors to make seat states visually distinct.
- Apply
rowGapandcolumnGapfor better readability in larger layouts. - If you have multiple categories (e.g., VIP, Balcony), give each section a unique theme.
- Always test colors in both dark mode and light mode for accessibility.