Skip to content

Conversation

@shinokada
Copy link
Collaborator

@shinokada shinokada commented Dec 1, 2025

🔗 Related issue (optional)

Closes #


📑 Description


🔍 PR Type

  • Bug fix
  • Feature
  • Documentation
  • Refactor / Code cleanup
  • Build / Tooling
  • Other (please describe)

🚦 PR Status

  • Draft (work in progress, not ready for review)
  • Ready for review ✅

✅ Checklist

  • My code follows the existing code style
  • I have run pnpm lint && pnpm check && pnpm test:e2e and all tests pass
  • CoderabbitAI review has been completed and actionable suggestions were reviewed
  • I have updated documentation if my changes require it
  • My PR is based on the latest main branch (not the published npm version)
  • I have checked accessibility where applicable (ARIA, keyboard nav, etc.)
  • I have reviewed the rendered component in the browser

🧪 Screenshots / Demos (optional)


⚠️ Breaking Changes (optional)


ℹ️ Additional Information

Summary by CodeRabbit

  • New Features

    • Centralized safe context API across many components for more robust context handling.
    • Pagination large variant hidden on small screens; gallery thumbnails update main image; datepicker adds Blur button; new theme demo page.
  • Bug Fixes

    • Corrected footer hyperlink.
    • Components more resilient to missing context, reducing runtime errors.
  • Documentation

    • Updated examples for buttons, indicators, keyboard, list-group, popover; added button-group context migration guide.
  • Chores

    • Bumped Svelte peer dependency to ^5.40.0.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 1, 2025

@shinokada is attempting to deploy a commit to the Themesberg Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 1, 2025

Walkthrough

Centralizes context handling by adding src/lib/context.ts with safe get/set context pairs and migrates many components from Svelte's getContext/setContext to getXContext/setXContext, adding defensive optional chaining; also bumps Svelte peer dependency in package.json.

Changes

Cohort / File(s) Summary
Context infrastructure
src/lib/context.ts
New centralized safe-context utility: createSafeContext plus many getXContext / setXContext pairs exported for UI contexts.
Package config
package.json
Bumped peerDependency svelte from ^5.29.0^5.40.0 (newline normalized).
Types
src/lib/types.ts
Reworked/expanded context interfaces; new context interfaces added and CarouselState relocated/converted; some prop/type adjustments (e.g., ButtonToggle roundedSize).
Accordion
src/lib/accordion/*
Provider now calls setAccordionContext(ctx) and consumer uses getAccordionContext() with optional chaining (Accordion.svelte, AccordionItem.svelte).
Bottom navigation
src/lib/bottom-navigation/*
Switched to setBottomNavContext / getBottomNavContext; provider supplies getter-backed context; consumers guard for undefined.
Carousel
src/lib/carousel/*
Replaced setContext/getContext with setCarouselContext/getCarouselContext; added defensive guards and fallbacks (e.g., slideDuration).
Drawer
src/lib/drawer/*
Uses setDrawerContext / getDrawerContext; placement exposed via getter-backed context (includes Drawer.svelte, DrawerHandle.svelte).
Dropdown
src/lib/dropdown/*
Provider uses setDropdownContext; consumers use getDropdownContext() and optional chaining for activeUrl (Dropdown.svelte, DropdownItem.svelte).
Pagination
src/lib/pagination/*
Consolidated pagination context via setPaginationContext/getPaginationContext; PaginationNav adds visiblePages prop (default 5).
Button toggle / Button group
src/lib/forms/button-toggle/*, src/lib/button-group/*, src/lib/buttons/*, src/lib/forms/*
Centralized setButtonToggleContext/getButtonToggleContext and setButtonGroupContext/getButtonGroupContext; many components now derive size/color/disabled from these accessors.
List / Listgroup / Li
src/lib/typography/list/*, src/lib/list-group/*
Replaced setContext/getContext with setListContext/getListContext and setListGroupContext/getListGroupContext; class derivations use ctx?.ctxClass.
Theme
src/lib/theme/*, src/lib/theme/themeUtils.ts
ThemeProvider now calls setThemeContext; theme utilities use getThemeContext().
Toolbar
src/lib/toolbar/*
Switched to setToolbarContext/getToolbarContext; ToolbarButton now passes background: false (removed dynamic background).
Stepper
src/lib/stepper/*
Removed setContext("stepperType", ...) calls from stepper variants (context propagation removed).
Navbar
src/lib/navbar/*
Replaced navbar context usage with setNavbarStateContext/getNavbarStateContext and breakpoint accessors; Navbar initializes typed state.
Sidebar
src/lib/sidebar/*
Introduced setSidebarContext/getSidebarContext and setActiveUrlContext/getActiveUrlContext; consumers now use optional chaining.
Table
src/lib/table/*
Replaced table context provisioning/consumption with setTableContext/getTableContext; TableSearch maps colorthemeColor and type usage adjusted.
Tabs
src/lib/tabs/*
Replaced setContext/getContext with setTabsContext/getTabsContext; register/unregister logic centralized into context.
Split pane
src/lib/split-pane/*
Split-pane context helpers moved to centralized context module; SplitPane.svelte removed exported set/get.
Docs / Examples / Routes
src/routes/docs-examples/**, src/routes/**
Multiple layout/styling tweaks, gallery filtering/thumbnails, pagination mobile-responsiveness, new theme-context-test page, and minor docs edits.
Misc / Small fixes
src/routes/admin-dashboard/.../Footer.svelte, src/lib/drawer/theme.ts, src/lib/tour/theme.ts, various example files
Small presentation tweaks (Tailwind class ordering/important modifiers), link fix ("//""/"), and component example adjustments.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45–75 minutes

Focus areas:

  • src/lib/context.ts — verify createSafeContext typing, runtime behavior when provider absent, and consistent naming across exported accessors.
  • src/lib/types.ts — ensure relocated/added interfaces match usages and update imports where types moved.
  • Representative provider/consumer pairs (Accordion, Carousel, Tabs, Table, Sidebar, PaginationNav) — confirm optional chaining/fallbacks preserve runtime behavior and that consumers handle undefined context safely.
  • PaginationNav.visiblePages — review docs/examples and tests for expected behavior.
  • SplitPane change — check that removed local set/get exports didn't leave any unresolved imports.

Possibly related PRs

  • Stores #1703 — Large overlap migrating many components from Svelte context to centralized context helpers; likely to intersect on API and usage.
  • Carousel #1711 — Related carousel refactors and state/type changes that may intersect with carousel context/type updates.
  • fix: types clean up #1609 — Modifies src/lib/types.ts; may conflict with the expanded/relocated type declarations introduced here.

Poem

🐰 I gathered contexts, stitched them neat,
Getters snug so children meet.
Providers set, and callers peek,
Optional hops make usage sleek.
A tiny hop, a tidy nest — a rabbit’s patchwork, best 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is essentially empty—it contains only the repository template with unchecked or minimally completed sections, lacking any substantive explanation of the changes, rationale, or migration details. Provide a detailed description explaining the refactoring motivation, scope of changes, new context patterns introduced, and any migration notes for developers using affected components.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main refactoring change: migrating from Svelte's setContext/getContext to a createContext pattern across the codebase.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ebe4e01 and 70c29d1.

📒 Files selected for processing (2)
  • src/lib/buttons/Button.svelte (1 hunks)
  • src/lib/forms/input-addon/InputAddon.svelte (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/forms/input-addon/InputAddon.svelte
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/buttons/Button.svelte
🔇 Additional comments (2)
src/lib/buttons/Button.svelte (2)

4-4: Type import narrowing looks good

Using only ButtonProps here aligns with the $props<ButtonProps>() usage and removes an unnecessary type import. No issues from a typing or runtime perspective.


7-11: Context helper migration preserves semantics; confirm helper’s fallback behavior

Switching to getButtonGroupContext() and deriving group/ctxDisabled via optional chaining keeps the previous behavior (treating any group presence as a truthy flag and aggregating disabled state) while centralizing context handling and avoiding errors when the group context is absent.

Please just confirm that getButtonGroupContext returns undefined (or a compatible falsy value) when no provider is present, rather than throwing, to fully match the old getContext behavior in non-group usage.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/routes/docs-examples/extend/button-toggle/ButtonColor.svelte (1)

19-24: Use separate state variables and handlers for independent button toggle groups.

Both ButtonToggleGroup instances currently share the same singleValue state and handleSingleSelect handler, causing selections in one group to deselect toggles in the other. According to Flowbite-Svelte documentation, multiple toggle groups should use independent state variables and handlers. Apply the suggested diff to give each group its own state (singleValue and singleValue2) and handler (handleSingleSelect and handleSingleSelect2).

♻️ Duplicate comments (1)
LIST_CONTEXT_MIGRATION.md (1)

1-168: Same documentation placement consideration applies.

See earlier comment on TOOLBAR_CONTEXT_MIGRATION.md regarding whether these migration guides should be retained, moved, or removed post-migration.

🧹 Nitpick comments (13)
src/routes/docs-examples/components/buttons/Outline.svelte (1)

5-10: Button outline variants look correct; double‑check docs layout after wrapper removal

The Button API usage (outline + color variants) is consistent and looks good. The only potential side effect is from dropping the previous flex wrapper (centering/gap), which may change how these buttons appear in the docs. Please verify the example still matches the intended layout and spacing; if not, consider reinstating an appropriate layout container higher up in the docs example.

src/lib/types.ts (1)

361-374: ButtonToggle context re‑export and roundedSize literals look consistent with the new context model

Exporting ButtonToggleContextType from $lib/context and wiring ButtonToggleGroupProps.roundedSize to an explicit "sm" | "md" | "lg" | "xl" | "full" union aligns with the centralized context/types cleanup and the theme-supported values. This also prevents "none" leaking into the public group API.

If you expect consumers to rely on "none" for the group prop, consider calling that out as a breaking (or tightening) change in release notes; otherwise this looks correct.

src/lib/dropdown/DropdownItem.svelte (1)

2-21: Dropdown context migration looks correct; consider simplifying isActive expression

Using getDropdownContext() with optional chaining keeps DropdownItem safe outside of a Dropdown and matches the new context pattern. The isActive logic is sound.

For readability you could simplify it to an explicit boolean:

const ctx = getDropdownContext();
let isActive = $derived(!!href && ctx?.activeUrl === href);

Functionally equivalent but a bit easier to scan.

src/routes/docs-examples/components/buttons/IconButton.svelte (1)

6-13: Structural simplification is fine; consider adding aria‑labels to icon‑only buttons

Dropping the extra wrapper and relying on the example container for layout is fine and keeps the snippet minimal.

Since these are icon‑only buttons and the docs emphasize accessibility, it would be a good time to add aria-label (or similar) to each Button so the example also demonstrates best practice for assistive technologies.

src/lib/carousel/CarouselIndicators.svelte (1)

2-7: Indicators now degrade gracefully when carousel context is missing

Using getCarouselContext() with the {#if _state} wrapper ensures indicators only render when state is available, avoiding previous hard failures. The optional chaining in goToIndex is a minor redundancy given the if _state guard, but it doesn’t hurt readability or behavior.

Also applies to: 13-18, 21-34

src/lib/carousel/Controls.svelte (1)

2-3: Controls context usage is safer; consider whether silent no‑ops are desired

Fetching state via getCarouselContext() and bailing out in changeSlide when _state is absent avoids runtime errors and keeps the API surface clean. If you’d rather not expose non-functional controls when used outside a carousel, you could additionally gate the rendered markup on _state, but that’s an API choice rather than a requirement.

Also applies to: 6-7, 12-17

src/lib/accordion/AccordionItem.svelte (1)

67-69: Consider simplifying the complex class derivation.

The expression on line 69 is quite dense with multiple fallback chains. While functionally correct, this could benefit from being broken into smaller, more readable pieces.

-  let buttonClass = $derived(clsx(open && !ctx?.flush && (styling.active || ctx?.activeClass || active()), !open && !ctx?.flush && (styling.inactive || ctx?.inactiveClass || inactive())));
+  let buttonClass = $derived.by(() => {
+    if (ctx?.flush) return "";
+    const activeStyles = styling.active || ctx?.activeClass || active();
+    const inactiveStyles = styling.inactive || ctx?.inactiveClass || inactive();
+    return clsx(open && activeStyles, !open && inactiveStyles);
+  });
src/lib/pagination/Pagination.svelte (1)

13-24: Missing activeClasses getter compared to PaginationNav.

PaginationNav.svelte provides an activeClasses getter in its context (line 50-52), but this component does not. This inconsistency may cause issues if consumers expect activeClasses to be available from either pagination provider.

Consider adding the getter for consistency:

   const ctx: PaginationContextType = {
     get group() {
       return true;
     },
     get table() {
       return table;
     },
     get size() {
       return size;
+    },
+    get activeClasses() {
+      return undefined; // or expose via props if needed
     }
   };
TOOLBAR_CONTEXT_MIGRATION.md (1)

1-224: Consider documentation placement.

This migration guide provides valuable context but may become stale once the migration is complete. Consider whether this should be:

  1. Moved to a docs/ or CONTRIBUTING.md section if it's meant to guide future contributors
  2. Removed after the migration is verified, keeping only inline code comments
  3. Kept as an ADR (Architecture Decision Record) in a dedicated location
src/lib/forms/button-toggle/ButtonToggle.svelte (1)

36-39: Consider documenting the size mapping rationale.

The size transformations (xssm, nonemd) are important business logic. A brief comment explaining why these mappings exist would help future maintainers.

   // Filter size to only valid buttonToggle sizes (no 'xs')
+  // buttonToggle theme doesn't support 'xs', map to 'sm' as closest alternative
   const actualSize = (size === "xs" ? "sm" : size) as VariantProps<typeof buttonToggle>["size"];
   // Filter roundedSize to only valid buttonToggle roundedSize values (remove 'none')
+  // 'none' is not a valid rounded variant, default to 'md' for consistent appearance
   const actualRoundedSize = (roundedSize === "none" ? "md" : roundedSize) as VariantProps<typeof buttonToggle>["roundedSize"];
src/lib/context.ts (2)

45-48: Inconsistent type definition locations.

Some context types are defined inline here (DrawerContextType, DropdownContextType, PaginationContextType, ButtonToggleContextType, ListContextType, ToolbarContextType), while others are imported from ./types (AccordionCtxType, BottomNavContextType, CarouselState).

For maintainability, consider consolidating all context type definitions either:

  1. All in ./types.ts with imports here, or
  2. All defined here and re-exported

The relevant code snippets show src/lib/types.ts re-exports these types, which suggests option 1 may be preferred for consistency.

Also applies to: 62-65, 79-85, 99-109, 123-126, 140-143


9-14: Consider extracting the try/catch wrapper into a helper.

The same try/catch pattern is repeated 10 times. A generic helper would reduce duplication:

function safeGetContext<T>(getter: () => T): T | undefined {
  try {
    return getter();
  } catch {
    return undefined;
  }
}

// Usage:
const getAccordionContext = () => safeGetContext(getAccordionContextRaw);

This reduces boilerplate and ensures consistent error handling across all contexts.

TYPE_ERRORS_FIXED.md (1)

192-210: Testing recommendations are thorough but lack automation details.

The testing recommendations cover the key scenarios affected by the fixes (size mapping, roundedSize mapping, and PaginationNav activeClasses). However, the recommendations are manual. Consider whether:

  1. Automated tests should verify the type-mapping behavior.
  2. The pnpm check recommendation should be expanded to include test execution.

Expand the testing section to include automated test recommendations:

## Testing Recommendations

### Automated Testing
- Add unit tests to verify size 'xs' → 'sm' mapping in ButtonToggle
- Add unit tests to verify roundedSize 'none' → 'md' mapping in ButtonToggle
- Add snapshot or integration tests for PaginationNav with ClassValue activeClasses
- Run: `pnpm test` to verify all changes

### Manual Testing
1. **Verify ButtonToggle with different sizes**:
   - Test with `size="xs"` (should map to 'sm')
   - ...
📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97f90da and 96e91d3.

📒 Files selected for processing (49)
  • LIST_CONTEXT_MIGRATION.md (1 hunks)
  • THEME_CONTEXT_MIGRATION.md (1 hunks)
  • TOOLBAR_CONTEXT_MIGRATION.md (1 hunks)
  • TYPE_ERRORS_FIXED.md (1 hunks)
  • package.json (2 hunks)
  • src/lib/accordion/Accordion.svelte (1 hunks)
  • src/lib/accordion/AccordionItem.svelte (3 hunks)
  • src/lib/bottom-navigation/BottomNav.svelte (2 hunks)
  • src/lib/bottom-navigation/BottomNavItem.svelte (3 hunks)
  • src/lib/carousel/Carousel.svelte (2 hunks)
  • src/lib/carousel/CarouselIndicators.svelte (1 hunks)
  • src/lib/carousel/Controls.svelte (1 hunks)
  • src/lib/carousel/Slide.svelte (1 hunks)
  • src/lib/context.ts (1 hunks)
  • src/lib/drawer/Drawer.svelte (2 hunks)
  • src/lib/drawer/DrawerHandle.svelte (1 hunks)
  • src/lib/dropdown/Dropdown.svelte (1 hunks)
  • src/lib/dropdown/DropdownItem.svelte (2 hunks)
  • src/lib/forms/button-toggle/ButtonToggle.svelte (3 hunks)
  • src/lib/forms/button-toggle/ButtonToggleGroup.svelte (2 hunks)
  • src/lib/pagination/Pagination.svelte (1 hunks)
  • src/lib/pagination/PaginationButton.svelte (1 hunks)
  • src/lib/pagination/PaginationItem.svelte (1 hunks)
  • src/lib/pagination/PaginationNav.svelte (2 hunks)
  • src/lib/theme/ThemeProvider.svelte (2 hunks)
  • src/lib/theme/themeUtils.ts (1 hunks)
  • src/lib/toolbar/Toolbar.svelte (1 hunks)
  • src/lib/toolbar/ToolbarButton.svelte (1 hunks)
  • src/lib/toolbar/ToolbarGroup.svelte (2 hunks)
  • src/lib/types.ts (4 hunks)
  • src/lib/typography/list/Li.svelte (1 hunks)
  • src/lib/typography/list/List.svelte (1 hunks)
  • src/routes/docs-examples/components/button-group/Disabled.svelte (1 hunks)
  • src/routes/docs-examples/components/buttons/IconButton.svelte (1 hunks)
  • src/routes/docs-examples/components/buttons/Outline.svelte (1 hunks)
  • src/routes/docs-examples/components/datepicker/ElementRef.svelte (1 hunks)
  • src/routes/docs-examples/components/gallery/Featured.svelte (1 hunks)
  • src/routes/docs-examples/components/gallery/Filters.svelte (1 hunks)
  • src/routes/docs-examples/components/pagination/Default.svelte (1 hunks)
  • src/routes/docs-examples/components/pagination/Default2.svelte (2 hunks)
  • src/routes/docs-examples/components/pagination/PreviousNext.svelte (2 hunks)
  • src/routes/docs-examples/components/pagination/PreviousNextIcons.svelte (2 hunks)
  • src/routes/docs-examples/extend/button-toggle/ButtonColor.svelte (1 hunks)
  • src/routes/docs/components/buttons.md (2 hunks)
  • src/routes/docs/components/indicators.md (1 hunks)
  • src/routes/docs/components/kbd.md (2 hunks)
  • src/routes/docs/components/list-group.md (1 hunks)
  • src/routes/docs/components/popover.md (2 hunks)
  • src/routes/theme-context-test/+page.svelte (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/dropdown/DropdownItem.svelte
  • src/routes/docs-examples/components/gallery/Filters.svelte
  • src/routes/theme-context-test/+page.svelte
  • src/routes/docs-examples/components/pagination/Default.svelte
  • src/lib/dropdown/Dropdown.svelte
  • src/lib/accordion/AccordionItem.svelte
  • src/routes/docs-examples/components/gallery/Featured.svelte
  • src/lib/pagination/PaginationButton.svelte
  • src/lib/toolbar/ToolbarGroup.svelte
  • src/lib/accordion/Accordion.svelte
  • src/routes/docs-examples/components/pagination/PreviousNextIcons.svelte
  • src/lib/carousel/CarouselIndicators.svelte
  • src/lib/theme/ThemeProvider.svelte
  • src/lib/typography/list/List.svelte
  • src/lib/toolbar/ToolbarButton.svelte
  • src/lib/toolbar/Toolbar.svelte
  • src/routes/docs-examples/components/datepicker/ElementRef.svelte
  • src/routes/docs-examples/components/buttons/Outline.svelte
  • src/lib/types.ts
  • src/lib/drawer/Drawer.svelte
  • src/lib/carousel/Carousel.svelte
  • src/lib/carousel/Controls.svelte
  • src/lib/theme/themeUtils.ts
  • src/lib/carousel/Slide.svelte
  • src/lib/pagination/PaginationItem.svelte
  • src/lib/pagination/Pagination.svelte
  • src/lib/drawer/DrawerHandle.svelte
  • src/lib/forms/button-toggle/ButtonToggleGroup.svelte
  • src/routes/docs-examples/extend/button-toggle/ButtonColor.svelte
  • src/routes/docs-examples/components/pagination/PreviousNext.svelte
  • src/lib/bottom-navigation/BottomNavItem.svelte
  • src/routes/docs-examples/components/pagination/Default2.svelte
  • src/routes/docs-examples/components/buttons/IconButton.svelte
  • src/lib/forms/button-toggle/ButtonToggle.svelte
  • src/routes/docs-examples/components/button-group/Disabled.svelte
  • src/lib/typography/list/Li.svelte
  • src/lib/bottom-navigation/BottomNav.svelte
  • src/lib/context.ts
  • src/lib/pagination/PaginationNav.svelte
🧠 Learnings (9)
📚 Learning: 2024-10-18T09:38:03.879Z
Learnt from: Chizaruu
Repo: themesberg/flowbite-svelte PR: 1465
File: src/lib/forms/Timepicker.svelte:105-116
Timestamp: 2024-10-18T09:38:03.879Z
Learning: In `Timepicker.svelte`, the `Dropdown` opens as intended and is used exclusively with the 'dropdown' and 'timerange-dropdown' Timepicker types.

Applied to files:

  • src/lib/dropdown/DropdownItem.svelte
  • src/lib/dropdown/Dropdown.svelte
  • src/routes/docs-examples/components/datepicker/ElementRef.svelte
  • src/lib/types.ts
📚 Learning: 2024-11-22T08:37:27.996Z
Learnt from: mrh1997
Repo: themesberg/flowbite-svelte PR: 1442
File: src/lib/utils/Popper.svelte:144-145
Timestamp: 2024-11-22T08:37:27.996Z
Learning: In `src/lib/utils/Popper.svelte`, inconsistencies in event handling (e.g., using both `mouseenter`/`mouseleave` and `pointerenter`/`pointerleave`) may be intentional to minimize modifications and reduce the risk of new problems.

Applied to files:

  • src/lib/dropdown/DropdownItem.svelte
  • src/routes/docs-examples/components/datepicker/ElementRef.svelte
  • src/routes/docs/components/popover.md
  • src/lib/forms/button-toggle/ButtonToggle.svelte
📚 Learning: 2025-11-25T07:26:46.504Z
Learnt from: CR
Repo: themesberg/flowbite-svelte PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T07:26:46.504Z
Learning: Applies to **/*.{svelte,ts,tsx,js,jsx} : Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components

Applied to files:

  • src/routes/docs-examples/components/gallery/Filters.svelte
  • package.json
  • src/routes/docs-examples/components/pagination/Default.svelte
  • src/routes/docs-examples/components/buttons/Outline.svelte
  • src/routes/docs-examples/components/button-group/Disabled.svelte
📚 Learning: 2025-11-25T07:26:39.377Z
Learnt from: CR
Repo: themesberg/flowbite-svelte PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T07:26:39.377Z
Learning: Use getComponentList tool to discover available Flowbite-Svelte components with their categories or to help users explore component options

Applied to files:

  • src/routes/docs-examples/components/gallery/Filters.svelte
  • src/routes/docs-examples/components/buttons/Outline.svelte
  • src/routes/docs-examples/components/button-group/Disabled.svelte
📚 Learning: 2025-11-25T07:26:46.504Z
Learnt from: CR
Repo: themesberg/flowbite-svelte PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T07:26:46.504Z
Learning: Use getComponentList tool to discover available Flowbite-Svelte components or help users explore component options

Applied to files:

  • src/routes/docs/components/kbd.md
  • src/routes/docs-examples/components/buttons/Outline.svelte
  • src/routes/docs-examples/components/button-group/Disabled.svelte
📚 Learning: 2024-11-12T10:36:34.807Z
Learnt from: LahTeuto
Repo: themesberg/flowbite-svelte PR: 1484
File: src/lib/navbar/NavLi.svelte:34-34
Timestamp: 2024-11-12T10:36:34.807Z
Learning: When enhancing ARIA roles in Svelte components, avoid setting `role="presentation"` on elements that should retain the `link` role, as it can diminish ARIA role coverage and negatively affect accessibility.

Applied to files:

  • src/routes/docs/components/buttons.md
📚 Learning: 2024-10-15T22:41:47.429Z
Learnt from: Chizaruu
Repo: themesberg/flowbite-svelte PR: 1464
File: src/routes/component-data/Datepicker.json:0-0
Timestamp: 2024-10-15T22:41:47.429Z
Learning: The component should be named 'Datepicker' (with lowercase 'p') throughout the codebase to maintain consistency.

Applied to files:

  • src/routes/docs-examples/components/datepicker/ElementRef.svelte
📚 Learning: 2025-03-20T12:47:33.307Z
Learnt from: superstes
Repo: themesberg/flowbite-svelte PR: 0
File: :0-0
Timestamp: 2025-03-20T12:47:33.307Z
Learning: In the Flowbite Svelte library's composite form components like MultiInput, when implementing focus styles with focus-within, create a dedicated focusWithinClasses object with appropriate colors for each state (base, primary, green, red). Using just 'focus-within:ring-1' without color specification won't correctly apply color-specific styling when the input receives focus directly.

Applied to files:

  • src/routes/docs-examples/components/buttons/Outline.svelte
📚 Learning: 2025-08-31T12:56:05.074Z
Learnt from: jjagielka
Repo: themesberg/flowbite-svelte PR: 1745
File: src/lib/types.ts:677-686
Timestamp: 2025-08-31T12:56:05.074Z
Learning: HTMLInputAttributes includes a `group` property that can be used for grouping form controls like checkboxes and radio buttons, so interfaces extending HTMLInputAttributes don't need to explicitly declare `group` unless they want to override its type.

Applied to files:

  • src/lib/types.ts
🧬 Code graph analysis (2)
src/lib/theme/themeUtils.ts (2)
src/lib/theme/index.ts (1)
  • ThemeConfig (6-8)
src/lib/context.ts (1)
  • getThemeContext (168-168)
src/lib/context.ts (1)
src/lib/types.ts (8)
  • AccordionCtxType (199-204)
  • BottomNavContextType (278-282)
  • CarouselState (405-412)
  • DrawerContextType (620-620)
  • DropdownContextType (639-639)
  • PaginationContextType (1190-1190)
  • ButtonToggleContextType (361-361)
  • ThemeConfig (1837-1837)
🔇 Additional comments (48)
src/routes/docs-examples/components/gallery/Filters.svelte (3)

19-21: Clean reactive state implementation with Svelte 5 runes.

Good use of $state and $derived for the filtering logic. The derived computation correctly handles both the "All" case and category-specific filtering.


24-30: Well-implemented filter buttons with correct active state handling.

The outline prop logic correctly shows solid buttons when selected and outlined buttons when not. The inline onclick handlers are appropriate for this simple state update pattern.


32-32: LGTM!

The Gallery correctly receives the derived filteredImages and will reactively update when the selected category changes.

src/routes/docs-examples/components/pagination/PreviousNext.svelte (1)

2-2: LGTM!

The addition of the pagination status display ("Showing {currentPage} of {totalPages} Entries") improves user experience by providing clear feedback about the current pagination state. The import and usage of the P component are correct.

Also applies to: 13-13

src/routes/docs/components/kbd.md (1)

31-31: LGTM!

The addition of class="flex flex-wrap gap-2" to the code fence attributes provides consistent, responsive layout styling for the KBD component examples in the documentation.

Also applies to: 63-63, 71-71, 79-79

src/routes/docs-examples/components/pagination/PreviousNextIcons.svelte (1)

2-2: LGTM!

Consistent with the pagination status display added to other pagination examples. This improves user experience by showing clear pagination state feedback.

Also applies to: 14-14

src/routes/docs-examples/components/datepicker/ElementRef.svelte (1)

10-16: LGTM!

The addition of the blur button complements the existing focus and select buttons well, providing a complete set of element reference interactions. The layout update to use flexbox with wrapping improves responsiveness.

THEME_CONTEXT_MIGRATION.md (1)

1-141: LGTM!

Excellent documentation for the Theme context migration. The document clearly explains the rationale, benefits, and implementation details of migrating from setContext/getContext to createContext. The inclusion of before/after examples, testing recommendations, and a reusable migration pattern for other contexts makes this a valuable reference for the team.

src/routes/docs-examples/components/gallery/Featured.svelte (1)

3-3: LGTM!

The interactive thumbnail gallery is well-implemented with proper typing using ImgType and Svelte 5's $state rune. The click handler correctly updates the main image when thumbnails are clicked, providing a clean and type-safe user experience.

Also applies to: 18-35

package.json (1)

105-105: Svelte 5.40.0 is available and compatible with the createContext API migration.

Svelte 5.40.0 exists and was released in November 2025. The version bump from ^5.29.0 to ^5.40.0 is safe—there are no breaking changes between these versions. The key improvement in 5.40.0 is that createContext now preserves and passes types with the stored context, eliminating the need to re-type getContext return values. This enhancement actually benefits the migration to the createContext API.

src/lib/types.ts (1)

619-621: Re‑exporting Drawer/Dropdown/Pagination context types is a good consolidation step

The new export type { DrawerContextType }, DropdownContextType, and PaginationContextType from $lib/context give consumers a single, consistent import surface for context typings and keep the definitions centralized. No functional risks here; this matches the broader context refactor.

Also applies to: 639-640, 1190-1191

src/routes/docs/components/indicators.md (1)

39-41: Legend example styling update improves readability and dark‑mode support

Adding text-sm font-medium text-gray-900 dark:text-white flex flex-wrap gap-2 makes the legend text more consistent with design tokens and prevents overflow when items wrap. Looks good.

src/routes/docs/components/list-group.md (1)

84-86: More responsive layout for horizontal list with tooltip

Switching to gap-4 flex flex-wrap justify-center items-center removes the hardcoded height and enables wrapping, which should behave better on smaller viewports while keeping alignment. Looks good.

src/lib/theme/ThemeProvider.svelte (1)

3-17: ThemeProvider now correctly uses the centralized theme context helper

Importing setThemeContext from $lib/context and calling it when a theme is provided aligns ThemeProvider with the new context system and keeps the public props unchanged. This is a straightforward, behavior‑preserving migration.

src/routes/docs/components/buttons.md (2)

224-226: Icon buttons example container now handles wrapping and vertical centering

Updating to flex flex-wrap items-center gap-2 should keep icon buttons aligned while allowing them to wrap cleanly on smaller screens. Looks good.


238-240: Loader example container made more responsive

Switching to flex flex-wrap justify-center gap-2 lets loader buttons wrap while remaining centered, which is friendlier on narrow viewports. No issues here.

src/lib/typography/list/Li.svelte (1)

4-11: Li now correctly consumes the centralized List context with safe fallback

Using getListContext() and ctx?.ctxClass to build liCls integrates Li with the new List context while still behaving sensibly when no provider is present. The clsx composition with the icon flag remains clear and maintainable.

src/lib/theme/themeUtils.ts (1)

3-3: LGTM! Clean migration to centralized context API.

The replacement of Svelte's getContext with getThemeContext correctly follows the PR's migration pattern, and the existing optional chaining safely handles undefined contexts.

Also applies to: 7-8

src/lib/drawer/DrawerHandle.svelte (1)

6-6: LGTM! Context migration correctly implemented.

The replacement of getContext("drawer") with getDrawerContext() aligns with the centralized context pattern, and optional chaining ensures safe access when context is undefined.

Also applies to: 10-10

src/routes/docs-examples/components/pagination/Default.svelte (1)

15-23: Verify SSR safety of window access.

The checkMobile function accesses window.innerWidth, which is only available in the browser. While onMount ensures this runs client-side, ensure the initial isMobile = false state provides acceptable SSR behavior (showing all pagination examples server-side, then hiding on mobile after hydration).

If SSR/hydration flash is a concern, consider adding a guard:

function checkMobile() {
+  if (typeof window === 'undefined') return;
  isMobile = window.innerWidth <= 640;
}
src/lib/toolbar/Toolbar.svelte (1)

14-25: LGTM! Clean getter/setter context pattern.

The migration to setToolbarContext with a getter/setter wrapper maintains reactivity while centralizing context management. The pattern correctly exposes separators through accessors backed by the reactive context.separators state.

src/routes/docs/components/popover.md (1)

54-54: LGTM! Documentation layout improvements.

The class updates improve responsive behavior (h-[550px] md:h-96) and example presentation, with no impact on component functionality.

Also applies to: 112-112

src/lib/dropdown/Dropdown.svelte (1)

16-23: LGTM! Simplified context with read-only getter.

The migration replaces the stateful store pattern with a cleaner getter-based approach. The activeUrl getter correctly defaults to an empty string when activeUrl prop is undefined, and consumers (like DropdownItem) appropriately access this as read-only context.

src/lib/toolbar/ToolbarButton.svelte (1)

15-15: Verify that hardcoding background: false is intentional.

The dynamic background behavior based on context has been removed, and background is now always false. Ensure this change doesn't break existing use cases where the background was dynamically set based on toolbar context.

src/lib/toolbar/ToolbarGroup.svelte (1)

5-5: Toolbar group context migration is safe and idiomatic

Using getToolbarContext() with a null-check before mutating ctx.separators keeps the previous behavior while avoiding errors when no toolbar context is present. No further changes needed here.

Also applies to: 14-16

src/lib/carousel/Carousel.svelte (1)

6-7: Centralized carousel context setup looks correct

Providing _state via setCarouselContext(_state) right after it’s created cleanly replaces direct setContext usage without changing behavior. The state object remains the single source of truth for slides and is available to all carousel children.

Also applies to: 56-59

src/routes/docs-examples/components/pagination/Default2.svelte (1)

4-7: Responsive pagination toggle is implemented safely

The isMobile state plus checkMobile and the mounted resize listener provide a clean, leak-free way to hide the large pagination on small viewports. Because checkMobile is only called inside the mount callback, this remains SSR-safe while preserving initial markup.

Also applies to: 39-47, 51-53

src/routes/theme-context-test/+page.svelte (1)

1-41: Theme context test page is well-scoped and representative

The page exercises default theming, a single provider, and multiple children in one provider using a minimal customTheme, which is exactly what you want for validating the theme context migration. No issues spotted.

src/lib/carousel/Slide.svelte (1)

2-3: Slide transitions now handle missing carousel context robustly

Using getCarouselContext() with optional chaining in the transition configs preserves existing behavior when state is present and falls back to sane defaults (duration ?? 1000, fixed directions) when it is not. This makes the slide component more resilient without changing its public API.

Also applies to: 5-6, 9-9, 15-21, 23-29

src/lib/bottom-navigation/BottomNavItem.svelte (1)

2-3: Bottom nav item context access is correctly guarded

Switching to getBottomNavContext() with optional access (context?.activeUrl, context?.navType, context?.activeClass) maintains the existing active-state and styling behavior when used within a BottomNav, while making standalone usage safe (no context, no active state). The class composition for active items remains consistent with the previous behavior.

Also applies to: 5-5, 17-21, 36-41

src/lib/typography/list/List.svelte (1)

14-22: LGTM! Clean context migration pattern.

The getter-based context object correctly exposes reactive state, and setListContext is appropriately called during component initialization. The $effect on lines 24-26 ensures contextClass stays synchronized with the ctxClass prop.

src/lib/pagination/PaginationItem.svelte (1)

12-23: LGTM! Proper optional chaining for context access.

The context retrieval correctly handles the case where the component is used outside a Pagination parent. The nullish coalescing operators provide sensible fallbacks to component props or default values.

src/lib/accordion/AccordionItem.svelte (1)

44-49: LGTM! Context migration with proper fallback handling.

The context is correctly retrieved with optional chaining. The transition type logic appropriately prioritizes the component's transitionType prop over the context value, ensuring local overrides work as expected.

src/lib/pagination/PaginationButton.svelte (1)

12-36: LGTM! Proper context handling with conditional styling.

The derived class computation correctly handles both the presence and absence of context. The ctx.activeClasses access on line 23 is safe due to the guard on line 16. The fallback pattern is consistent with other pagination components.

src/lib/forms/button-toggle/ButtonToggleGroup.svelte (2)

54-68: LGTM! Toggle selection logic with onSelect callback.

The toggleSelected function correctly manages both single and multi-select modes, and properly invokes the onSelect callback after each state change. The state management with selectedValues is reactive and will work correctly through the context getter.


79-108: Destructured props in context getters may lose reactivity if props change dynamically.

The getters for multiSelect, color, size, roundedSize, ctxIconClass, and ctxBtnClass reference destructured props that may not update reactively if the parent component changes these values after mount in Svelte 5.

Verify whether these props are intended to be static or dynamic. If dynamic updates are expected, consider using $props() or alternative approaches to maintain reactivity.

src/lib/bottom-navigation/BottomNav.svelte (1)

19-32: Destructured props in context getters may not reflect updates in Svelte 5.

Destructuring props breaks reactivity in Svelte 5. When context getters reference destructured prop values, they capture the initial values and won't update when parent props change.

Consider maintaining prop reactivity by accessing them without destructuring:

+  const props = $props<BottomNavProps>();
+  
   const context: BottomNavContextType = {
     get activeClass() {
       return activeCls;
     },
     get activeUrl() {
-      return activeUrl;
+      return props.activeUrl ?? "";
     },
     get navType() {
-      return navType;
+      return props.navType ?? "default";
     }
   };

Alternatively, use $derived($props()) to keep destructured values reactive.

src/lib/accordion/Accordion.svelte (1)

13-30: LGTM! Clean migration to getter-based context.

The context object correctly exposes reactive getters that reference the component's props directly. This pattern ensures consumers always receive current values without needing a store wrapper.

src/lib/pagination/PaginationNav.svelte (1)

39-56: LGTM! Complete context implementation.

The context object correctly provides all PaginationContextType fields with reactive getters. The activeClasses getter properly handles the optional classes prop with optional chaining.

src/lib/drawer/Drawer.svelte (1)

29-36: LGTM! Clean context implementation.

The drawer context correctly exposes the placement prop through a getter, allowing child components like DrawerHandle.svelte to reactively access the current placement.

src/lib/forms/button-toggle/ButtonToggle.svelte (1)

18-30: LGTM! Robust context consumption with proper fallbacks.

The destructuring pattern with fallback values handles the case when the component is used outside of ButtonToggleGroup. The no-op function for toggleSelected and false for isSelected ensure the component remains functional standalone.

src/lib/context.ts (1)

1-4: Verify createContext import compatibility with Svelte version.

The import createContext from "svelte" is a Svelte 5 API available since v5.40.0. Ensure the package.json peer dependency reflects this requirement.

TYPE_ERRORS_FIXED.md (6)

1-26: Clarify the intended purpose and permanence of this documentation.

This file appears to be added as a permanent repository artifact to document type errors fixed during the migration. However, it's unclear whether this is appropriate as a committed file or if this information should live in PR documentation, a CHANGELOG, or a migration guide instead.

Key concerns:

  • Line numbers (e.g., PaginationNav.svelte:44, ButtonToggle.svelte:40) will become stale as code evolves.
  • The file references a specific migration event, which typically belongs in release notes or changelogs rather than permanent documentation.
  • No guidance on whether this is a temporary reference or long-term documentation.

Please confirm:

  1. Is this file meant to be a permanent migration guide in the repository?
  2. If yes, should it be placed in a docs/ directory or similar?
  3. Should the content be consolidated into CHANGELOG.md, a migration guide, or release notes instead?
  4. Will this file be maintained as code evolves, or is it a snapshot of this specific PR?

172-190: Acknowledge the explanation of why stricter type checking revealed these errors.

The explanation that createContext provides stricter type checking than getContext is sound and helps contextualize why these issues surfaced. This is a good catch by the migration, as it improves type safety.


124-142: Verify that all context type consolidation was completed consistently across the codebase.

The documentation claims that PaginationContextType, DrawerContextType, DropdownContextType, and ButtonToggleContextType were all consolidated to /src/lib/context.ts and re-exported from /src/lib/types.ts. However, this requires verification against the actual codebase to ensure no lingering duplicates or inconsistent imports exist. Check that:

  1. All four context types are defined in src/lib/context.ts
  2. All four are properly re-exported from src/lib/types.ts
  3. No duplicate type definitions remain in types.ts
  4. All imports throughout the codebase reference the consolidated types correctly

7-49: Verify that the PaginationContextType consolidation is correctly implemented across all files.

The documentation states that PaginationContextType was defined in two places (types.ts and context.ts) and the fix was to remove the duplicate and re-export from context.ts. However, the actual implementation could not be verified due to repository access limitations. The same verification applies to DrawerContextType and DropdownContextType mentioned for consistency.

To confirm this consolidation is complete, verify:

  1. PaginationContextType is defined only once in /src/lib/context.ts
  2. /src/lib/types.ts re-exports it with export type { PaginationContextType } from "$lib/context"
  3. No duplicate definition exists in /src/lib/types.ts
  4. The same pattern applies to DrawerContextType and DropdownContextType

101-122: Manual verification required for type assertions and import handling in ButtonToggle.svelte.

The three points requested for verification cannot be automatically confirmed:

  1. Whether VariantProps import from tailwind-variants is correctly used in the type assertion
  2. Whether the context type for color is appropriately narrowed or remains a temporary workaround
  3. Whether the unused import warning for ButtonToggleVariants was actually resolved

Please manually confirm these implementation details by examining:

  • The import statements at the top of ButtonToggle.svelte (line 4 and surrounding imports)
  • The actualColor variable assignment around line 49
  • The ButtonToggleContextType definition in context.ts to verify the color property type

51-98: Verify ButtonToggle size and roundedSize filtering implementation

The documentation describes type filtering logic that maps 'xs' to 'sm' for size and 'none' to 'md' for roundedSize. These mappings require verification to ensure:

  1. The filtering actually prevents type errors in ButtonToggle.svelte
  2. The mapped values are semantically correct (e.g., 'xs' → 'sm' makes visual sense)
  3. All components using ButtonToggle context are aware of these mappings
  4. Type definitions in context.ts (ButtonToggleContextType) and types.ts (ButtonToggleGroupProps) match the documented values

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (6)
src/lib/navbar/NavUl.svelte (1)

11-12: Consider optional chaining for consistency with Table components.

The non-null assertions (!) will throw runtime errors if NavUl is used outside a Navbar context. While this fail-fast approach is valid, it's inconsistent with the defensive optional chaining pattern used in TableBodyRow.svelte and TableHead.svelte (lines 14-17 in those files).

If you prefer consistency and more graceful degradation, consider:

-  let navState = getNavbarStateContext()!;
-  let navBreakpoint = getNavbarBreakpointContext()!;
+  let navState = getNavbarStateContext();
+  let navBreakpoint = getNavbarBreakpointContext();

Then update line 55 to handle potentially undefined context:

-  let hidden: boolean = $derived(navState.hidden ?? true);
+  let hidden: boolean = $derived(navState?.hidden ?? true);

And line 57:

-  let { base, ul, active, nonActive } = $derived(navbarUl({ hidden, breakpoint: navBreakpoint }));
+  let { base, ul, active, nonActive } = $derived(navbarUl({ hidden, breakpoint: navBreakpoint ?? "md" }));

However, if the intent is to enforce that NavUl must always be used within a Navbar, the current fail-fast approach is acceptable.

src/lib/navbar/NavHamburger.svelte (1)

17-18: Consider optional chaining for consistency with Table components.

Similar to NavUl.svelte, the non-null assertions here will cause runtime errors if NavHamburger is used outside a Navbar context. This is inconsistent with the defensive optional chaining pattern in the Table components.

If graceful degradation is preferred:

-  const navState = getNavbarStateContext()!;
-  const navBreakpoint = getNavbarBreakpointContext()!;
+  const navState = getNavbarStateContext();
+  const navBreakpoint = getNavbarBreakpointContext();

Then guard access on line 22:

   const toggle: MouseEventHandler<HTMLButtonElement> = () => {
-    navState.hidden = !navState.hidden;
+    if (navState) navState.hidden = !navState.hidden;
   };

And line 19:

-  const { base, menu } = navbarHamburger({ breakpoint: navBreakpoint });
+  const { base, menu } = navbarHamburger({ breakpoint: navBreakpoint ?? "md" });

Alternatively, if strict enforcement that NavHamburger must be within Navbar is intended, the current approach is valid.

src/lib/navbar/NavLi.svelte (1)

3-9: Navbar context migration is consistent; consider avoiding non‑null assertions

Using getNavbarStateContext() / getNavbarBreakpointContext() aligns with the new centralized context API, but the ! assertions mean you’ll still hard‑fail at runtime if the navbar context is missing. If the intent of createSafeContext is to allow safer/optional consumption, consider handling the undefined case explicitly (e.g., guard or fallback) or throwing a clearer error when context is absent.

src/lib/sidebar/SidebarItem.svelte (1)

2-15: Simplify active state expression; ?? fallback is never used

The migration to getSidebarContext / getActiveUrlContext looks good, and the optional chaining on activeUrl is safe. However:

  • activeItem is always a boolean:
    let activeItem = $derived(
      active !== undefined ? active : activeUrl?.value ? href === activeUrl?.value : false
    );
  • Consequently, (activeItem ?? activeUrl?.value === href) in both aCls and aria-current can never evaluate the right-hand side, because false is not nullish.

You can simplify and make intent clearer:

- let activeItem = $derived(active !== undefined ? active : activeUrl?.value ? href === activeUrl?.value : false);
-
- let aCls = $derived((activeItem ?? activeUrl?.value === href) ? (activeClass ?? context.activeClass) : (nonActiveClass ?? context.nonActiveClass));
+ let activeItem = $derived(
+   active !== undefined
+     ? active
+     : activeUrl?.value
+     ? href === activeUrl.value
+     : false
+ );
+
+ let aCls = $derived(
+   activeItem
+     ? activeClass ?? context.activeClass
+     : nonActiveClass ?? context.nonActiveClass
+ );

And similarly for aria-current:

- aria-current={(activeItem ?? activeUrl?.value === href) ? "page" : undefined}
+ aria-current={activeItem ? "page" : undefined}

This keeps the behavior the same while removing dead code and improving readability.

Also applies to: 18-18

src/lib/table/TableSearch.svelte (1)

2-4: Table context wiring looks correct; avoid duplicating color mapping

The switch to setTableContext with a TableCtxType payload looks consistent with the new context module, and the “custom” color handling is sound. You currently duplicate the "custom" → "default" mapping:

const themeColor = color === "custom"
  ? "default"
  : (color as /* union */);

const tableSearchCtx: TableCtxType = {
  striped,
  hoverable,
  color: color === "custom" ? "default" : (color as TableVariants["color"])
};

To keep things DRY and ensure the context and visual styling stay in sync, you can reuse themeColor:

- const themeColor = color === "custom" ? "default" : (color as TableVariants["color"]);
+ const themeColor = color === "custom" ? "default" : (color as TableVariants["color"]);
...
- const tableSearchCtx: TableCtxType = {
-   striped,
-   hoverable,
-   color: color === "custom" ? "default" : (color as TableVariants["color"])
- };
+ const tableSearchCtx: TableCtxType = {
+   striped,
+   hoverable,
+   color: themeColor
+ };

This removes redundant logic and keeps any future changes to the color mapping centralized.

Also applies to: 50-64, 66-67

src/lib/context.ts (1)

22-38: Safe context helpers look good; clarify / wire up TableSearch context

The createSafeContext wrapper around Svelte’s createContext is a clean way to expose getXContext(): T | undefined / setXContext() pairs and avoid hard throws when a provider is missing. The various contexts (Accordion, BottomNav, Carousel, Drawer, Dropdown, Pagination, ButtonToggle, List, Toolbar, Theme, ListGroup, ButtonGroup, Navbar, Sidebar, Table) all follow this pattern consistently.

At the bottom:

// Table
const [getTableContext, setTableContext] = createSafeContext<TableCtxType>();

// TableSearch (also uses tableCtx key for compatibility)
const [getTableSearchContext, setTableSearchContext] = createSafeContext<TableSearchType>();

Two points to verify:

  1. In this PR, TableSearch.svelte uses setTableContext(...) but does not appear to call setTableSearchContext(...), and other table components use getTableContext(...). That makes getTableSearchContext/setTableSearchContext effectively unused right now; consider either wiring them up where needed or dropping them to avoid dead API surface.

  2. The comment “also uses tableCtx key for compatibility” reflects the old string‑keyed context pattern; with createContext each call creates its own key, so this comment is now misleading unless you intentionally share the same [get,set] pair between Table and TableSearch.

Tidying this up (by either using or removing the TableSearch context and updating the comment) will reduce confusion for future maintainers.

Also applies to: 88-108

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 940250a and bf95b61.

📒 Files selected for processing (14)
  • src/lib/context.ts (1 hunks)
  • src/lib/navbar/NavHamburger.svelte (1 hunks)
  • src/lib/navbar/NavLi.svelte (1 hunks)
  • src/lib/navbar/NavUl.svelte (1 hunks)
  • src/lib/navbar/Navbar.svelte (1 hunks)
  • src/lib/sidebar/Sidebar.svelte (3 hunks)
  • src/lib/sidebar/SidebarDropdownWrapper.svelte (2 hunks)
  • src/lib/sidebar/SidebarItem.svelte (1 hunks)
  • src/lib/table/Table.svelte (2 hunks)
  • src/lib/table/TableBodyRow.svelte (1 hunks)
  • src/lib/table/TableHead.svelte (1 hunks)
  • src/lib/table/TableSearch.svelte (2 hunks)
  • src/lib/types.ts (1 hunks)
  • src/routes/admin-dashboard/(no-sidebar)/Footer.svelte (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/routes/admin-dashboard/(no-sidebar)/Footer.svelte
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/navbar/Navbar.svelte
  • src/lib/navbar/NavUl.svelte
  • src/lib/table/TableBodyRow.svelte
  • src/lib/sidebar/SidebarItem.svelte
  • src/lib/table/Table.svelte
  • src/lib/sidebar/SidebarDropdownWrapper.svelte
  • src/lib/navbar/NavLi.svelte
  • src/lib/context.ts
  • src/lib/sidebar/Sidebar.svelte
  • src/lib/table/TableSearch.svelte
  • src/lib/types.ts
  • src/lib/table/TableHead.svelte
  • src/lib/navbar/NavHamburger.svelte
🧠 Learnings (2)
📚 Learning: 2024-11-22T08:37:27.996Z
Learnt from: mrh1997
Repo: themesberg/flowbite-svelte PR: 1442
File: src/lib/utils/Popper.svelte:144-145
Timestamp: 2024-11-22T08:37:27.996Z
Learning: In `src/lib/utils/Popper.svelte`, inconsistencies in event handling (e.g., using both `mouseenter`/`mouseleave` and `pointerenter`/`pointerleave`) may be intentional to minimize modifications and reduce the risk of new problems.

Applied to files:

  • src/lib/navbar/NavUl.svelte
  • src/lib/sidebar/Sidebar.svelte
  • src/lib/navbar/NavHamburger.svelte
📚 Learning: 2024-10-18T09:38:03.879Z
Learnt from: Chizaruu
Repo: themesberg/flowbite-svelte PR: 1465
File: src/lib/forms/Timepicker.svelte:105-116
Timestamp: 2024-10-18T09:38:03.879Z
Learning: In `Timepicker.svelte`, the `Dropdown` opens as intended and is used exclusively with the 'dropdown' and 'timerange-dropdown' Timepicker types.

Applied to files:

  • src/lib/sidebar/SidebarDropdownWrapper.svelte
🧬 Code graph analysis (2)
src/lib/context.ts (1)
src/lib/types.ts (16)
  • AccordionCtxType (351-356)
  • BottomNavContextType (359-363)
  • CarouselState (366-373)
  • DrawerContextType (376-378)
  • DropdownContextType (381-383)
  • PaginationContextType (386-391)
  • ButtonToggleContextType (394-403)
  • ListContextType (406-408)
  • ToolbarContextType (411-413)
  • ListGroupContextType (416-419)
  • ButtonGroupContextType (422-425)
  • NavbarState (1181-1186)
  • NavbarBreakpoint (1188-1188)
  • SidebarCtxType (1445-1452)
  • TableCtxType (1756-1761)
  • TableSearchType (1827-1831)
src/lib/types.ts (2)
src/lib/bottom-navigation/theme.ts (1)
  • BottomNavVariants (5-5)
src/lib/forms/button-toggle/theme.ts (1)
  • ButtonToggleVariants (17-17)
🔇 Additional comments (7)
src/lib/navbar/Navbar.svelte (1)

7-15: LGTM! Clean migration to centralized context API.

The explicit NavbarState type parameter on line 13 improves type safety, and the new context setters from $lib/context provide a cleaner, more maintainable API surface.

src/lib/sidebar/SidebarDropdownWrapper.svelte (1)

5-6: LGTM! Safe fallback pattern implemented correctly.

The fallback object { isSingle: false } on line 43 prevents runtime errors when the sidebar context is unavailable. The non-null assertion on line 60 is safe because it's guarded by the ctx.isSingle check, and the selected store is guaranteed to be initialized when isSingle is true (lines 47-49).

Also applies to: 43-60

src/lib/sidebar/Sidebar.svelte (1)

6-6: LGTM! Clean context setter migration.

The migration to setSidebarContext and setActiveUrlContext is straightforward and maintains the existing behavior.

Also applies to: 60-60, 84-84

src/lib/table/Table.svelte (1)

2-2: LGTM! Straightforward context setter migration.

Also applies to: 37-37

src/lib/table/TableBodyRow.svelte (1)

2-2: LGTM! Excellent defensive programming with optional chaining.

The optional chaining (?.) on lines 14-17 gracefully handles cases where the table context might be unavailable, with sensible fallback defaults.

Also applies to: 12-17

src/lib/table/TableHead.svelte (1)

2-2: LGTM! Consistent defensive pattern with optional chaining.

The implementation matches TableBodyRow.svelte's approach, providing graceful degradation when context is unavailable.

Also applies to: 13-17

src/lib/types.ts (1)

347-403: Verify roundedSize union consistency between ButtonToggleContextType and ButtonToggleGroupProps

The new "Context Types" section is well-structured and aligns with src/lib/context.ts imports.

However, a potential inconsistency exists with button-toggle rounding:

  • ButtonToggleContextType.roundedSize: "sm" | "md" | "lg" | "none" | "xl" | "full"
  • ButtonToggleGroupProps.roundedSize: "sm" | "md" | "lg" | "xl" | "full" (missing "none")

If ButtonToggleVariants["roundedSize"] supports "none", the public prop type is stricter than the context type, which may break existing code. Ensure both unions align with the actual theme support, and confirm whether "none" should be included or excluded from both.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/lib/types.ts (1)

393-403: Align roundedSize unions between ButtonToggle context and props

ButtonToggleContextType.roundedSize includes "none" but ButtonToggleGroupProps.roundedSize now omits it. This asymmetry can be confusing and allows "none" in the context even though the public prop type no longer accepts it.

Consider either:

  • Removing "none" from ButtonToggleContextType.roundedSize if it’s no longer a supported variant, or
  • Re‑adding "none" to ButtonToggleGroupProps.roundedSize if you still want to support it externally.

Also applies to: 429-436

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf95b61 and ea51479.

📒 Files selected for processing (11)
  • src/lib/context.ts (1 hunks)
  • src/lib/navbar/NavHamburger.svelte (1 hunks)
  • src/lib/navbar/NavLi.svelte (1 hunks)
  • src/lib/navbar/NavUl.svelte (2 hunks)
  • src/lib/sidebar/SidebarItem.svelte (1 hunks)
  • src/lib/split-pane/Pane.svelte (1 hunks)
  • src/lib/split-pane/SplitPane.svelte (1 hunks)
  • src/lib/table/TableSearch.svelte (2 hunks)
  • src/lib/tabs/TabItem.svelte (2 hunks)
  • src/lib/tabs/Tabs.svelte (2 hunks)
  • src/lib/types.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/lib/navbar/NavHamburger.svelte
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/table/TableSearch.svelte
  • src/lib/tabs/TabItem.svelte
  • src/lib/navbar/NavUl.svelte
  • src/lib/context.ts
  • src/lib/tabs/Tabs.svelte
  • src/lib/split-pane/Pane.svelte
  • src/lib/navbar/NavLi.svelte
  • src/lib/types.ts
  • src/lib/split-pane/SplitPane.svelte
  • src/lib/sidebar/SidebarItem.svelte
🧠 Learnings (1)
📚 Learning: 2024-11-22T08:37:27.996Z
Learnt from: mrh1997
Repo: themesberg/flowbite-svelte PR: 1442
File: src/lib/utils/Popper.svelte:144-145
Timestamp: 2024-11-22T08:37:27.996Z
Learning: In `src/lib/utils/Popper.svelte`, inconsistencies in event handling (e.g., using both `mouseenter`/`mouseleave` and `pointerenter`/`pointerleave`) may be intentional to minimize modifications and reduce the risk of new problems.

Applied to files:

  • src/lib/navbar/NavUl.svelte
  • src/lib/navbar/NavLi.svelte
🧬 Code graph analysis (2)
src/lib/context.ts (1)
src/lib/types.ts (17)
  • AccordionCtxType (351-356)
  • BottomNavContextType (359-363)
  • CarouselState (366-373)
  • DrawerContextType (376-378)
  • DropdownContextType (381-383)
  • PaginationContextType (386-391)
  • ButtonToggleContextType (394-403)
  • ListContextType (406-408)
  • ToolbarContextType (411-413)
  • ThemeConfig (1895-1895)
  • ListGroupContextType (416-419)
  • ButtonGroupContextType (422-425)
  • NavbarState (1181-1186)
  • NavbarBreakpoint (1188-1188)
  • SidebarCtxType (1445-1452)
  • SplitPaneContext (2268-2278)
  • TabsContextType (1883-1888)
src/lib/types.ts (2)
src/lib/bottom-navigation/theme.ts (1)
  • BottomNavVariants (5-5)
src/lib/forms/button-toggle/theme.ts (1)
  • ButtonToggleVariants (17-17)
🔇 Additional comments (8)
src/lib/split-pane/Pane.svelte (1)

13-27: LGTM! Excellent defensive coding.

The context retrieval and usage properly handles the case where context might be undefined through consistent use of optional chaining and conditional checks.

src/lib/navbar/NavUl.svelte (1)

11-12: LGTM! Proper defensive context handling.

The code correctly handles potentially undefined context values through:

  • Optional chaining (navState?.hidden)
  • Fallback values (?? true, ?? "md")
  • Guard clause (line 60) before property mutations

Also applies to: 55-64

src/lib/navbar/NavLi.svelte (1)

8-9: LGTM! Excellent defensive context handling.

The migration to centralized context accessors is implemented safely with:

  • Consistent optional chaining for context property access (navState?.activeUrl, navState?.hidden, navState?.activeClass)
  • Appropriate fallback values (navBreakpoint ?? "md", navState?.hidden ?? true)
  • Guard clause before state mutation (line 26)

Also applies to: 15-22, 24-28

src/lib/types.ts (3)

347-373: Context interfaces are cohesive and match their component responsibilities

The new context types (accordion, bottom nav, carousel, drawer, dropdown, pagination, button toggle, list, toolbar, list group, button group) are well-scoped, use existing variant types appropriately, and provide clear contracts for the centralized context module.

Also applies to: 375-425


1883-1888: TabsContextType cleanly models tab registration and shared state

The TabsContextType interface (activeClasses, shared TabCtxType, register/unregister callbacks) is straightforward and provides a solid contract for tabs consumers.


2268-2278: SplitPaneContext matches SplitPane/Divider contracts well

The SplitPaneContext interface mirrors the props on SplitPane and Divider (direction, dragging state, size/style getters, mouse/touch/keyboard handlers), which should make context usage type‑safe and predictable.

src/lib/context.ts (2)

23-39: Safe context wrapper is simple and preserves types

createSafeContext<T>() cleanly wraps Svelte’s context API, exposing a getter that safely returns undefined when no provider is present while keeping a strongly‑typed setter. The tuple as const keeps inference tight for consumers.


41-113: Centralized getXContext/setXContext exports improve consistency across components

Defining all contexts through createSafeContext (for accordion, navigation, carousel, drawer, dropdown, pagination, button toggle, list, toolbar, theme, list group, button group, navbar, sidebar, active URL, table, split pane, and tabs) gives a single, type‑safe source of truth and should simplify future refactors.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/lib/forms/select/MultiSelect.svelte (1)

41-42: Simplify context assignment by inlining getButtonGroupContext

groupCtx is an unnecessary intermediate; you can inline for brevity without changing behavior:

-  const groupCtx = getButtonGroupContext();
-  const group = groupCtx;
+  const group = getButtonGroupContext();

Since group is only used in grouped: !!group, this keeps the intent clear and types should still flow from the helper.

src/lib/forms/select/Select.svelte (1)

37-38: Inline getButtonGroupContext for clarity and to match MultiSelect

You can remove the extra groupCtx variable and mirror a simpler pattern:

-  const groupCtx = getButtonGroupContext();
-  const group = groupCtx;
+  const group = getButtonGroupContext();

Keeps the code shorter and consistent with other components using the same helper.

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ffe87d4 and a9db948.

📒 Files selected for processing (12)
  • MIGRATION_BUTTONGROUP_CONTEXT.md (1 hunks)
  • src/lib/button-group/ButtonGroup.svelte (1 hunks)
  • src/lib/buttons/Button.svelte (1 hunks)
  • src/lib/buttons/GradientButton.svelte (1 hunks)
  • src/lib/forms/input-addon/InputAddon.svelte (2 hunks)
  • src/lib/forms/input-field/Input.svelte (2 hunks)
  • src/lib/forms/select/MultiSelect.svelte (2 hunks)
  • src/lib/forms/select/Select.svelte (2 hunks)
  • src/routes/docs-examples/forms/number-input/Control.svelte (1 hunks)
  • src/routes/docs-examples/forms/number-input/ControlIcon.svelte (1 hunks)
  • src/routes/docs-examples/forms/number-input/Counter.svelte (1 hunks)
  • src/routes/docs-examples/forms/phone-input/Select.svelte (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/button-group/ButtonGroup.svelte
  • src/lib/forms/input-field/Input.svelte
  • src/lib/buttons/Button.svelte
  • src/routes/docs-examples/forms/number-input/Control.svelte
  • src/lib/forms/input-addon/InputAddon.svelte
  • src/lib/buttons/GradientButton.svelte
  • src/routes/docs-examples/forms/phone-input/Select.svelte
  • src/routes/docs-examples/forms/number-input/Counter.svelte
  • src/routes/docs-examples/forms/number-input/ControlIcon.svelte
  • src/lib/forms/select/Select.svelte
  • src/lib/forms/select/MultiSelect.svelte
🧠 Learnings (3)
📚 Learning: 2025-08-31T12:56:05.074Z
Learnt from: jjagielka
Repo: themesberg/flowbite-svelte PR: 1745
File: src/lib/types.ts:677-686
Timestamp: 2025-08-31T12:56:05.074Z
Learning: HTMLInputAttributes includes a `group` property that can be used for grouping form controls like checkboxes and radio buttons, so interfaces extending HTMLInputAttributes don't need to explicitly declare `group` unless they want to override its type.

Applied to files:

  • src/lib/button-group/ButtonGroup.svelte
  • src/lib/forms/input-field/Input.svelte
  • src/lib/forms/input-addon/InputAddon.svelte
📚 Learning: 2025-03-20T12:47:33.307Z
Learnt from: superstes
Repo: themesberg/flowbite-svelte PR: 0
File: :0-0
Timestamp: 2025-03-20T12:47:33.307Z
Learning: In the Flowbite Svelte library's composite form components like MultiInput, when implementing focus styles with focus-within, create a dedicated focusWithinClasses object with appropriate colors for each state (base, primary, green, red). Using just 'focus-within:ring-1' without color specification won't correctly apply color-specific styling when the input receives focus directly.

Applied to files:

  • src/lib/forms/input-field/Input.svelte
📚 Learning: 2024-10-18T09:38:03.879Z
Learnt from: Chizaruu
Repo: themesberg/flowbite-svelte PR: 1465
File: src/lib/forms/Timepicker.svelte:105-116
Timestamp: 2024-10-18T09:38:03.879Z
Learning: In `Timepicker.svelte`, the `Dropdown` opens as intended and is used exclusively with the 'dropdown' and 'timerange-dropdown' Timepicker types.

Applied to files:

  • src/lib/forms/select/Select.svelte
  • src/lib/forms/select/MultiSelect.svelte
🪛 LanguageTool
MIGRATION_BUTTONGROUP_CONTEXT.md

[style] ~137-~137: This phrase is redundant. Consider using “outside”.
Context: ...nsure proper styling 3. Test components outside of ButtonGroup to ensure they work indepen...

(OUTSIDE_OF)

🔇 Additional comments (11)
src/routes/docs-examples/forms/number-input/ControlIcon.svelte (1)

17-17: Verify Tailwind version and confirm scope of styling change.

The class attribute now uses !w-40 for the important modifier. Tailwind v3 uses the prefix syntax (!w-40), while Tailwind v4 requires suffix syntax (w-40!). Flowbite-Svelte supports both versions. Please confirm which version this project uses, and if v4, update to w-40!.

Additionally, this styling change (width increase from w-28 to w-40) appears unrelated to the PR's stated objective of migrating from setContext/getContext to createContext. Clarify whether this is an intentional styling update or scope creep.

src/routes/docs-examples/forms/number-input/Control.svelte (1)

9-15: Confirm Tailwind important modifier syntax for !w-32

The layout change looks fine, but !w-32 uses the old leading-! important syntax. If the project is on Tailwind v4, the recommended form is w-32! instead. Please confirm this matches the Tailwind version you’re targeting and adjust if needed.

src/routes/docs-examples/forms/phone-input/Select.svelte (1)

18-20: Select styling within ButtonGroup looks good

Using classes={{ select: "border-r-0" }} keeps the visual merge with the Clipboard button while simplifying the class list. No behavioral issues spotted.

src/lib/buttons/Button.svelte (1)

4-11: ButtonGroup context migration is consistent and safe

Using getButtonGroupContext() and deriving group/ctxDisabled from it cleanly replaces the previous raw context access, with correct undefined-safe handling when no provider is present. The rest of the sizing/disabled logic continues to behave as before.

src/lib/forms/input-field/Input.svelte (1)

4-5: Input’s ButtonGroup context wiring and size fallback look correct

The switch to getButtonGroupContext() and the _size resolution (size → clamped group.size"md") preserves existing behavior while handling the absence of a ButtonGroup provider safely. No issues spotted with grouped styling or combobox behavior.

Also applies to: 74-78

src/lib/buttons/GradientButton.svelte (1)

4-10: GradientButton group context migration aligns with new API

Obtaining the group information via getButtonGroupContext() and passing group: !!group into the theme keeps grouped styling behavior intact while avoiding direct getContext usage.

src/lib/button-group/ButtonGroup.svelte (1)

6-13: Centralized ButtonGroup context setup looks correct

Replacing the separate setContext("group") / setContext("disabled") calls with setButtonGroupContext({ size, disabled }) cleanly matches the new context API and keeps the initial size/disabled propagation semantics unchanged.

src/lib/forms/input-addon/InputAddon.svelte (1)

6-12: InputAddon group context and size computation are consistent

Using getButtonGroupContext() and deriving _size from explicit size → clamped group.size"md" is consistent with the other consumers and keeps grouped border behavior (group && "not-first:-ms-px") intact.

Also applies to: 33-34

MIGRATION_BUTTONGROUP_CONTEXT.md (1)

1-142: Migration doc accurately reflects the implemented ButtonGroup context changes

The before/after snippets and the described benefits match the updated implementations in ButtonGroup, Button, GradientButton, InputAddon, and Input, and the testing recommendations cover the key usage scenarios. Nothing blocking here.

src/lib/forms/select/MultiSelect.svelte (1)

3-10: Imports now correctly match actual usage

Removing SizeType from the type import, dropping getContext, and keeping onMount plus adding getButtonGroupContext all align with the current code usage and the new centralized context API. No functional issues here.

src/lib/forms/select/Select.svelte (1)

4-8: Type and context imports are consistent with the new API

Using only SelectProps from $lib and importing getButtonGroupContext (while no longer relying on Svelte’s getContext) is consistent with the refactor to centralized context helpers. No issues from a typing or runtime perspective.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/routes/blocks/utils/Newsletter.svelte (1)

37-46: Tailwind important modifier syntax looks incorrect (sm:w-96!)

sm:w-96! is not valid Tailwind syntax; the important modifier should prefix the utility (e.g., sm:!w-96). As written, Tailwind will likely ignore this class and the small‑breakpoint width won't apply as intended.

Consider fixing the class:

-                class="formkit-input focus:ring-primary-600 focus:border-primary-600 pl-12 text-gray-900 sm:w-96!"
+                class="formkit-input focus:ring-primary-600 focus:border-primary-600 pl-12 text-gray-900 sm:!w-96"

(or just sm:w-96 if you don't actually need !).

🧹 Nitpick comments (2)
src/routes/docs-examples/forms/number-input/ControlIcon.svelte (1)

17-17: Consider removing the !important modifier if possible.

The w-40! class uses Tailwind's important modifier, which typically indicates a specificity conflict with other styles. While this works, it may be better to resolve the underlying specificity issue rather than forcing the style with !important.

If the important modifier is needed to override Flowbite's Input component styles, consider whether:

  1. The component can be styled more specifically without !important
  2. This is documented as an intentional override

Note: This styling change appears unrelated to the PR's main objective of migrating to createContext.

src/lib/buttons/Button.svelte (1)

4-5: getButtonGroupContext integration looks correct; consider a small cleanup

The migration to ButtonProps plus getButtonGroupContext() for group size/disabled is consistent with the new context API, and the derived actualSize, actualColor, and isDisabled calculations still behave as before.

For a tiny readability and micro-optimization improvement, you could call the context helper once and clarify naming, e.g.:

-import { getButtonGroupContext } from "$lib/context";
-
-const group = getButtonGroupContext()?.size;
-const ctxDisabled = getButtonGroupContext()?.disabled;
+import { getButtonGroupContext } from "$lib/context";
+
+const groupContext = getButtonGroupContext();
+const group = groupContext?.size;
+const ctxDisabled = groupContext?.disabled;

This makes it clear that group is the group size value and avoids calling the getter twice.

Also applies to: 7-10

📜 Review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9db948 and ebe4e01.

📒 Files selected for processing (12)
  • src/lib/buttons/Button.svelte (1 hunks)
  • src/lib/buttons/GradientButton.svelte (1 hunks)
  • src/lib/drawer/theme.ts (1 hunks)
  • src/lib/forms/input-addon/InputAddon.svelte (2 hunks)
  • src/lib/forms/input-field/Input.svelte (2 hunks)
  • src/lib/forms/select/MultiSelect.svelte (2 hunks)
  • src/lib/forms/select/Select.svelte (2 hunks)
  • src/lib/tour/theme.ts (1 hunks)
  • src/routes/blocks/utils/Newsletter.svelte (1 hunks)
  • src/routes/docs-examples/forms/number-input/Control.svelte (1 hunks)
  • src/routes/docs-examples/forms/number-input/ControlIcon.svelte (1 hunks)
  • src/routes/docs-examples/forms/number-input/Counter.svelte (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/lib/buttons/GradientButton.svelte
  • src/lib/forms/select/MultiSelect.svelte
  • src/lib/forms/select/Select.svelte
  • src/routes/docs-examples/forms/number-input/Counter.svelte
  • src/routes/docs-examples/forms/number-input/Control.svelte
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{svelte,ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{svelte,ts,tsx,js,jsx}: Use the Flowbite-Svelte MCP server to discover components by name or category before implementing UI components
Always use findComponent tool FIRST to locate the correct Flowbite-Svelte component before fetching documentation
After calling findComponent, use getComponentDoc tool to fetch complete documentation including usage examples, props, and best practices for Flowbite-Svelte components

Files:

  • src/lib/forms/input-field/Input.svelte
  • src/routes/blocks/utils/Newsletter.svelte
  • src/lib/buttons/Button.svelte
  • src/lib/forms/input-addon/InputAddon.svelte
  • src/routes/docs-examples/forms/number-input/ControlIcon.svelte
  • src/lib/drawer/theme.ts
  • src/lib/tour/theme.ts
🧠 Learnings (2)
📚 Learning: 2025-08-31T12:56:05.074Z
Learnt from: jjagielka
Repo: themesberg/flowbite-svelte PR: 1745
File: src/lib/types.ts:677-686
Timestamp: 2025-08-31T12:56:05.074Z
Learning: HTMLInputAttributes includes a `group` property that can be used for grouping form controls like checkboxes and radio buttons, so interfaces extending HTMLInputAttributes don't need to explicitly declare `group` unless they want to override its type.

Applied to files:

  • src/lib/forms/input-field/Input.svelte
  • src/lib/forms/input-addon/InputAddon.svelte
📚 Learning: 2025-03-20T12:47:33.307Z
Learnt from: superstes
Repo: themesberg/flowbite-svelte PR: 0
File: :0-0
Timestamp: 2025-03-20T12:47:33.307Z
Learning: In the Flowbite Svelte library's composite form components like MultiInput, when implementing focus styles with focus-within, create a dedicated focusWithinClasses object with appropriate colors for each state (base, primary, green, red). Using just 'focus-within:ring-1' without color specification won't correctly apply color-specific styling when the input receives focus directly.

Applied to files:

  • src/lib/forms/input-field/Input.svelte
🔇 Additional comments (2)
src/lib/drawer/theme.ts (1)

16-17: Verify Tailwind CSS version and consistency of important modifier syntax.

The review comment recommends modernizing Tailwind CSS syntax from prefix notation (!w-full) to suffix notation (w-full!), which is supported in Tailwind v3.1+. However, verification is needed to confirm:

  1. The project's Tailwind CSS version supports suffix important modifiers (v3.1+)
  2. This syntax pattern is applied consistently across theme files to maintain code uniformity

Without confirming version compatibility and codebase consistency, the approval cannot be finalized.

src/lib/forms/input-field/Input.svelte (1)

4-5: Button group context migration and size derivation look consistent

Using getButtonGroupContext() for group and computing _size as size || (group?.size ? clampSize(group.size) : undefined) || "md" keeps the previous precedence (explicit size > group size > "md"), avoids relying on clampSize for undefined values, and aligns this input with the new centralized button-group context helpers. I don't see any functional or type-safety issues here.

Also applies to: 74-77

progressContainer: "flex gap-2 justify-center",
progressDot: ["w-2 h-2 rounded-full bg-gray-300", "hover:bg-gray-400 transition-all duration-200 hover:scale-110"],
progressDotActive: "!bg-blue-500 !w-6 rounded",
progressDotActive: "!bg-blue-500 w-6! rounded",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's see the full context of the file
echo "=== Full file content ===" 
cat -n src/lib/tour/theme.ts

echo ""
echo "=== Searching for w-[0-9]+ with trailing ! ===" 
rg -n "w-[0-9]+!" src/lib

echo ""
echo "=== Searching for !w-[0-9]+ with leading ! ===" 
rg -n "!w-[0-9]+" src/lib

Repository: themesberg/flowbite-svelte

Length of output: 196


🌐 Web query:

Tailwind CSS ! important modifier syntax trailing vs leading

💡 Result:

Short answer: Tailwind uses a leading exclamation mark as a prefix (e.g. !bg-red-500). A trailing exclamation (bg-red-500!) is not the Tailwind syntax.

Details/examples:

  • Add ! immediately before the utility name (after any variant prefixes): sm:hover:!bg-red-500. [1]
  • The ! makes the generated declaration use !important; it’s distinct from the config-level important option. [1][2]

Sources:
[1] Tailwind CSS docs — Important modifier.
[2] Tailkits article — Using !important in Tailwind.


Change w-6! to !w-6 to use correct Tailwind priority modifier syntax

Tailwind requires the ! prefix to come immediately before the utility name, not after it. The current w-6! is invalid syntax; it should be !w-6 to match the already-correct !bg-blue-500 on the same line. This inconsistency will likely cause the width priority modifier to not apply as intended.

🤖 Prompt for AI Agents
In src/lib/tour/theme.ts around line 18, the Tailwind priority modifier is
placed after the utility (w-6!) which is invalid; change that token to the
correct prefix form (!w-6) so the priority applies properly and matches the
existing !bg-blue-500 on the same line.

@shinokada shinokada merged commit 73e2713 into themesberg:main Dec 3, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant