Skip to content

Conversation

@MGREMY
Copy link
Collaborator

@MGREMY MGREMY commented Aug 17, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

  • Docs have been added/updated (for bug fixes/features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • CI-related changes
  • Documentation content changes
  • Other... Please describe:

Issue Number

Issue Number: N/A

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Added a reusable Table component with header/body/footer slots, data-driven rows, color variants, optional striped rows, and customizable theming.
  • Documentation

    • New Table docs page with live demo and theme previews, Storybook stories illustrating usage and controls, and a README for the table package.
  • Chores

    • Published a new table package entry point, added TypeScript path alias, updated docs API includes, and adjusted Tailwind extension settings.

@vercel
Copy link

vercel bot commented Aug 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
flowbite-angular Ready Ready Preview Comment Aug 17, 2025 8:09pm
flowbite-angular-storybook Ready Ready Preview Comment Aug 17, 2025 8:09pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new Flowbite Angular Table feature (component, head/body/foot directives, themes, DI configs, and state), docs and Storybook demos, a secondary library entry point with packaging and README, updates tooling/templates and tsconfig paths, and adjusts VSCode Tailwind experimental config path.

Changes

Cohort / File(s) Summary
Editor config
.vscode/settings.json
Changed Tailwind experimental config path to apps/docs/public/css/styles.css.
Docs — Table
apps/docs/docs/components/table/_default.component.html, apps/docs/docs/components/table/_default.component.ts, apps/docs/docs/components/table/index.md, apps/docs/docs/components/table/ng-doc.page.ts, apps/docs/docs/ng-doc.api.ts
Adds Table docs page, demo component/template, theme display in ng-doc page, and includes table module in NgDoc API.
Storybook — Table
apps/storybook/src/table.component.stories.ts
Adds Storybook stories for Table with controls/args and a render template using head/body/foot slots.
Library: Table core
libs/flowbite-angular/table/src/table/*, libs/flowbite-angular/table/src/config/table-config.ts, libs/flowbite-angular/table/src/index.ts, libs/flowbite-angular/table/ng-package.json, libs/flowbite-angular/table/README.md
New standalone Table component, theme/types, DI config, barrel exports, packaging config and README for secondary entry point.
Library: Table Head
libs/flowbite-angular/table/src/table-head/*, libs/flowbite-angular/table/src/config/table-head-config.ts
Adds TableHead directive, state token/provider/injector, head theme, and DI config.
Library: Table Body
libs/flowbite-angular/table/src/table-body/*, libs/flowbite-angular/table/src/config/table-body-config.ts
Adds TableBody directive, state token/provider/injector, body theme (zebra/colored), and DI config.
Library: Table Foot
libs/flowbite-angular/table/src/table-foot/*, libs/flowbite-angular/table/src/config/table-foot-config.ts
Adds TableFoot directive, state token/provider/injector, foot theme, and DI config.
State helpers / generators
libs/flowbite-angular/table/src/*-state.ts, libs/tools/src/generators/component/files/component/.../__fileName__-state.ts.template
Adds Flowbite-prefixed state tokens/exports across new table state modules and updates generator template to use Flowbite-prefixed state tokens.
Tooling & TS paths
tsconfig.base.json
Adds path alias "flowbite-angular/table"libs/flowbite-angular/table/src/index.ts.

Sequence Diagram(s)

sequenceDiagram
  participant App as App Template
  participant Table as Table Component
  participant Head as TableHead Dir
  participant Body as TableBody Dir
  participant Foot as TableFoot Dir
  participant Cfg as DI Config
  participant State as State Tokens

  App->>Table: bind tableHead/tableBody/tableFoot/data
  Table->>Cfg: injectFlowbiteTableConfig()
  Table->>State: provideFlowbiteTableState()
  Table->>Head: project header template
  Table->>Body: iterate data → project row templates
  Table->>Foot: project footer template
  Head->>Cfg: injectFlowbiteTableHeadConfig()
  Body->>Cfg: injectFlowbiteTableBodyConfig()
  Foot->>Cfg: injectFlowbiteTableFootConfig()
  Head->>State: provide/inject head state
  Body->>State: provide/inject body state
  Foot->>State: provide/inject foot state
  Table->>App: render with merged themes (color/striped)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

released on @alpha

Poem

In burrows of code I hop and play,
Rows and columns neatly lay.
Head, body, foot in tidy theme,
I stripe and color every dream.
A little rabbit ships the change — hooray! 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1fad27b and 0b29332.

📒 Files selected for processing (1)
  • libs/flowbite-angular/table/src/config/table-config.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/table

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 4

🔭 Outside diff range comments (1)
libs/tools/src/generators/component/files/component/__directoryName__/src/__fileName__/__fileName__-state.ts.template (1)

1-14: State token is typed to the component class instead of a state shape

Typing the state token as <%= className %> couples DI state to the component class and will propagate incorrect typings in generated code. Tokens should represent the state shape (e.g., Flowbite<%= className %>State) to keep DI contracts clean and future-proof.

Apply this diff to generate a dedicated state type and correctly type the token and description:

-import type { <%= className %> } from './<%= fileName %>.component';
-
 import {
   createState,
   createStateInjector,
   createStateProvider,
   createStateToken,
 } from 'ng-primitives/state';
 
-export const Flowbite<%= className %>StateToken = createStateToken<<%= className %>>('Flowbite <%= className %>');
+// Define the shape of the component state. Extend this as needed when implementing the component.
+export interface Flowbite<%= className %>State {
+  // TODO: add properties for component state
+}
+
+export const Flowbite<%= className %>StateToken =
+  createStateToken<Flowbite<%= className %>State>('Flowbite <%= className %> State');
 export const provideFlowbite<%= className %>State = createStateProvider(Flowbite<%= className %>StateToken);
 export const injectFlowbite<%= className %>State = createStateInjector(Flowbite<%= className %>StateToken);
 export const flowbite<%= className %>State = createState(Flowbite<%= className %>StateToken);
🧹 Nitpick comments (27)
libs/tools/src/generators/component/files/component/__directoryName__/src/__fileName__/__fileName__-state.ts.template (1)

10-10: Nit: include “State” in the token description for clarity

The human-readable token description currently omits “State”. Including it improves debugging clarity in DI error messages.

If you don’t adopt the full refactor above, at least tweak the description:

-export const Flowbite<%= className %>StateToken = createStateToken<<%= className %>>('Flowbite <%= className %>');
+export const Flowbite<%= className %>StateToken = createStateToken<<%= className %>>('Flowbite <%= className %> State');
libs/flowbite-angular/table/src/table/theme.ts (1)

18-48: Reduce duplication for per-color text classes

All colors map to the same light/dark text classes. You can DRY this up for maintainability without losing flexibility.

 export const flowbiteTableTheme: FlowbiteTableTheme = createTheme({
   host: {
     base: 'w-full text-left text-sm',
-    color: {
-      default: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-      info: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-      failure: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-      success: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-      warning: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-      primary: {
-        light: 'text-gray-500',
-        dark: 'dark:text-gray-400',
-      },
-    },
+    color: (() => {
+      const common = { light: 'text-gray-500', dark: 'dark:text-gray-400' } as const;
+      return {
+        default: common,
+        info: common,
+        failure: common,
+        success: common,
+        warning: common,
+        primary: common,
+      };
+    })(),
   },
 });
libs/flowbite-angular/table/src/table-foot/theme.ts (1)

17-41: Reduce duplication in color variants (DRY) and confirm variant intent

The same light/dark classes are repeated for all variants. If the footer is intentionally neutral regardless of variant, consider consolidating to a shared mapping to ease maintenance. If you intend semantic variants (e.g., red for failure), map those accordingly instead of using neutral gray for all.

Add a shared mapping once and reuse it:

// Place near the top of the file (outside the diff range)
const sharedTextColor = {
  light: 'text-gray-900',
  dark: 'dark:text-white',
} as const;

Apply this diff to reduce repetition:

   export const flowbiteTableFootTheme: FlowbiteTableFootTheme = createTheme({
     host: {
       base: 'font-semibold',
       color: {
-        default: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
-        info: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
-        failure: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
-        success: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
-        warning: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
-        primary: {
-          light: 'text-gray-900',
-          dark: 'dark:text-white',
-        },
+        default: sharedTextColor,
+        info: sharedTextColor,
+        failure: sharedTextColor,
+        success: sharedTextColor,
+        warning: sharedTextColor,
+        primary: sharedTextColor,
       },
     },
   });
libs/flowbite-angular/table/src/config/table-config.ts (3)

1-2: Combine duplicate imports from the same module

Importing from '../table/theme' twice is unnecessary; merge into a single import for clarity.

Apply this diff:

-import type { FlowbiteTableColors } from '../table/theme';
-import { flowbiteTableTheme, type FlowbiteTableTheme } from '../table/theme';
+import { flowbiteTableTheme, type FlowbiteTableTheme, type FlowbiteTableColors } from '../table/theme';

44-49: Shallow merge may discard nested customTheme overrides across providers

The spread merge is shallow. If multiple modules call provideFlowbiteTableConfig (or you want additive updates), nested objects like customTheme will be overwritten instead of merged.

If you need additive merges, switch to a factory provider and deep-merge:

  • create a tiny deepMerge utility (or reuse an existing one in the repo if available)
  • use useFactory with deps: [FlowbiteTableConfigToken] (optional) to merge with an existing config if present

I can draft a deepMerge helper and provider wiring if you want.


56-57: Guard against accidental mutation of the default config

Returning the exported defaultFlowbiteTableConfig by reference allows accidental mutation to affect all consumers. Return a shallow copy (or freeze the default) to reduce risk.

Apply this diff for a minimal safeguard:

-export const injectFlowbiteTableConfig = (): FlowbiteTableConfig =>
-  inject(FlowbiteTableConfigToken, { optional: true }) ?? defaultFlowbiteTableConfig;
+export const injectFlowbiteTableConfig = (): FlowbiteTableConfig => {
+  const cfg = inject(FlowbiteTableConfigToken, { optional: true }) ?? defaultFlowbiteTableConfig;
+  // Shallow copy to prevent accidental mutation of the shared default object
+  return { ...cfg, customTheme: { ...cfg.customTheme } };
+};

Optionally also freeze the default:

// After defaultFlowbiteTableConfig declaration
Object.freeze(defaultFlowbiteTableConfig);
Object.freeze(defaultFlowbiteTableConfig.customTheme);
apps/docs/docs/components/table/index.md (1)

5-18: Consider adding an accessibility note to the docs

A short note on proper table semantics (caption, thead/tbody/tfoot usage, th scope) would help users build accessible tables alongside the new component.

I can draft an A11Y section for this page with example markup if useful.

apps/docs/docs/components/table/_default.component.ts (1)

13-17: Prefer a clearer data initializer and explicit typing

i++ inside the Array.from map is unnecessary and confusing. Also, explicit typing helps doc readers.

-export class FlowbiteDefaultComponent {
-  readonly data = Array.from({ length: 5 }, (_, i) => i++).map((x) => ({
-    name: `Product ${x}`,
-    qty: x,
-    price: x * x,
-  }));
-}
+export class FlowbiteDefaultComponent {
+  readonly data: Array<{ name: string; qty: number; price: number }> = Array.from(
+    { length: 5 },
+    (_, i) => i
+  ).map((x) => ({
+    name: `Product ${x}`,
+    qty: x,
+    price: x * x,
+  }));
+}
apps/docs/docs/components/table/_default.component.html (3)

30-33: Remove invalid scope attribute on <td>

scope is only valid on <th>. Keeping it on <td> is invalid HTML.

-      <td
-        scope="row"
-        class="px-6 py-4">
+      <td
+        class="px-6 py-4">

45-48: Remove invalid scope attribute in footer <td> as well

Same issue as above; scope should not be used on <td>.

-      <td
-        scope="row"
-        class="px-6 py-4">
+      <td
+        class="px-6 py-4">

50-51: Optional: Compute totals instead of hardcoding

For consistency and to avoid confusion in docs, consider computing totals from data rather than hardcoding 10 and 30.

libs/flowbite-angular/table/src/table-body/table-body.directive.ts (1)

18-21: Minor: Use empty string for presence-only data attribute

When using data attributes as presence flags, prefer empty string for presence and null for absence. Avoids setting "true" as the value.

  host: {
     '[class]': `theme().host.root`,
-    '[attr.data-striped]': 'tableState().striped() || undefined',
+    '[attr.data-striped]': `tableState().striped() ? '' : null`,
  },
apps/storybook/src/table.component.stories.ts (2)

70-77: Simplify data generation

Use (_, i) => i instead of i++ for clarity.

   args: {
     color: defaultFlowbiteTableConfig.color,
     striped: defaultFlowbiteTableConfig.striped,
-    data: Array.from({ length: 5 }, (_, i) => i++).map((x) => ({
+    data: Array.from({ length: 5 }, (_, i) => i).map((x) => ({
       name: `Product ${x}`,
       qty: x,
       price: x * x,
     })),
     customTheme: defaultFlowbiteTableConfig.customTheme,
   },

81-123: Optional: Remove invalid scope attribute on <td> in story template

Same HTML validity concern as in the docs component.

-            <td scope="row" class="px-6 py-4">
+            <td class="px-6 py-4">
               {{ data.name }}
             </td>
...
-            <td scope="row" class="px-6 py-4">
+            <td class="px-6 py-4">
               Total
             </td>
libs/flowbite-angular/table/src/table-body/table-body-state.ts (1)

10-13: Add minimal JSDoc for public API clarity

These exports are part of the public surface. Brief JSDoc improves discoverability in IDEs/autocomplete.

+/** Injection token for per-instance TableBody state */
 export const FlowbiteTableBodyStateToken = createStateToken<TableBody>('Flowbite TableBody');
+/** Provider for TableBody state; add to the directive's providers */
 export const provideFlowbiteTableBodyState = createStateProvider(FlowbiteTableBodyStateToken);
+/** Injector helper for TableBody state; use in consumers within the subtree */
 export const injectFlowbiteTableBodyState = createStateInjector(FlowbiteTableBodyStateToken);
+/** State factory bound to FlowbiteTableBodyStateToken */
 export const flowbiteTableBodyState = createState(FlowbiteTableBodyStateToken);
libs/flowbite-angular/table/src/table-head/table-head-state.ts (1)

10-13: Consider adding brief JSDoc on the public exports

Improves DX without affecting runtime.

+/** Injection token for per-instance TableHead state */
 export const FlowbiteTableHeadStateToken = createStateToken<TableHead>('Flowbite TableHead');
+/** Provider for TableHead state; add to the directive's providers */
 export const provideFlowbiteTableHeadState = createStateProvider(FlowbiteTableHeadStateToken);
+/** Injector helper for TableHead state */
 export const injectFlowbiteTableHeadState = createStateInjector(FlowbiteTableHeadStateToken);
+/** State factory bound to FlowbiteTableHeadStateToken */
 export const flowbiteTableHeadState = createState(FlowbiteTableHeadStateToken);
libs/flowbite-angular/table/src/table-head/theme.ts (1)

14-44: Color variants are comprehensive; consider small consistency tweaks (optional)

Two optional polish ideas:

  • Align dark-mode text shade consistency across variants (e.g., mostly -400, but failure/primary use -300). If intentional for contrast, ignore.
  • Consider adding tracking-wider to host.base to match common table header styling in Flowbite examples.

If you want, I can propose a follow-up patch aligning the shades and base classes.

libs/flowbite-angular/table/src/table-foot/table-foot-state.ts (1)

10-13: Add brief JSDoc for exported public API (optional)

Improves IDE help and documentation generation.

+/** Injection token for per-instance TableFoot state */
 export const FlowbiteTableFootStateToken = createStateToken<TableFoot>('Flowbite TableFoot');
+/** Provider for TableFoot state; add to the directive's providers */
 export const provideFlowbiteTableFootState = createStateProvider(FlowbiteTableFootStateToken);
+/** Injector helper for TableFoot state */
 export const injectFlowbiteTableFootState = createStateInjector(FlowbiteTableFootStateToken);
+/** State factory bound to FlowbiteTableFootStateToken */
 export const flowbiteTableFootState = createState(FlowbiteTableFootStateToken);
libs/flowbite-angular/table/src/config/table-head-config.ts (1)

34-41: Consider deep-merging customTheme to preserve nested overrides

Shallow spreading will replace the entire customTheme object. If consumers provide only a fragment, deep-merge avoids accidentally dropping defaults.

Apply this change:

+import { mergeDeep } from 'flowbite-angular';
@@
 export const provideFlowbiteTableHeadConfig = (
   config: Partial<FlowbiteTableHeadConfig>
 ): Provider[] => [
   {
     provide: FlowbiteTableHeadConfigToken,
-    useValue: { ...defaultFlowbiteTableHeadConfig, ...config },
+    useValue: {
+      baseTheme: config.baseTheme ?? defaultFlowbiteTableHeadConfig.baseTheme,
+      customTheme: mergeDeep(
+        defaultFlowbiteTableHeadConfig.customTheme,
+        config.customTheme ?? {}
+      ),
+    },
   },
 ];
libs/flowbite-angular/table/src/config/table-body-config.ts (1)

34-41: Deep-merge customTheme for safer per-key overrides

Mirrors the head/foot config: deep-merge avoids clobbering unrelated theme keys when consumers supply partial overrides.

Proposed change:

+import { mergeDeep } from 'flowbite-angular';
@@
 export const provideFlowbiteTableBodyConfig = (
   config: Partial<FlowbiteTableBodyConfig>
 ): Provider[] => [
   {
     provide: FlowbiteTableBodyConfigToken,
-    useValue: { ...defaultFlowbiteTableBodyConfig, ...config },
+    useValue: {
+      baseTheme: config.baseTheme ?? defaultFlowbiteTableBodyConfig.baseTheme,
+      customTheme: mergeDeep(
+        defaultFlowbiteTableBodyConfig.customTheme,
+        config.customTheme ?? {}
+      ),
+    },
   },
 ];
libs/flowbite-angular/table/src/config/table-foot-config.ts (1)

34-41: Deep-merge customTheme to prevent losing defaults

Align with head/body: preserve nested keys when a consumer supplies only a subset of customTheme.

Suggested diff:

+import { mergeDeep } from 'flowbite-angular';
@@
 export const provideFlowbiteTableFootConfig = (
   config: Partial<FlowbiteTableFootConfig>
 ): Provider[] => [
   {
     provide: FlowbiteTableFootConfigToken,
-    useValue: { ...defaultFlowbiteTableFootConfig, ...config },
+    useValue: {
+      baseTheme: config.baseTheme ?? defaultFlowbiteTableFootConfig.baseTheme,
+      customTheme: mergeDeep(
+        defaultFlowbiteTableFootConfig.customTheme,
+        config.customTheme ?? {}
+      ),
+    },
   },
 ];
libs/flowbite-angular/table/src/table-head/table-head.directive.ts (1)

29-41: Optional: declare state before computed theme to avoid forward-reference pitfalls

computed() is lazy, so this currently works. Declaring state above theme makes the dependency order explicit and future-proof if eager eval ever enters the picture.

libs/flowbite-angular/table/src/table/table.component.ts (4)

28-40: Render thead/tfoot conditionally to avoid empty table sections

Avoid emitting empty <thead>/<tfoot> when corresponding templates are absent.

Apply:

-    <thead>
-      <ng-container [ngTemplateOutlet]="state.tableHead()" />
-    </thead>
+    @if (state.tableHead()) {
+      <thead>
+        <ng-container [ngTemplateOutlet]="state.tableHead()" />
+      </thead>
+    }
@@
-    <tfoot>
-      <ng-container [ngTemplateOutlet]="state.tableFoot()" />
-    </tfoot>
+    @if (state.tableFoot()) {
+      <tfoot>
+        <ng-container [ngTemplateOutlet]="state.tableFoot()" />
+      </tfoot>
+    }

23-23: Remove empty hostDirectives for brevity

hostDirectives: [] is a no-op and can be removed.

-  hostDirectives: [],

45-84: Consider adding basic tests for state defaults and template wiring

Smoke tests that verify: (1) default data renders zero rows without error, (2) thead/tfoot render only when templates are supplied, and (3) theme host classes update with color would reduce regressions.

I can scaffold minimal TestBed specs for these cases if you want.


48-51: Provide Safe Defaults for Table Inputs

To avoid runtime errors when data is undefined and to make template inputs explicitly nullable, set default values on the input signals in libs/flowbite-angular/table/src/table/table.component.ts:

  • Default data to an empty array so the @for loop never receives undefined.
  • Default tableHead, tableBody, and tableFoot to null for clearer intent and stronger type safety.

Apply this diff:

   export class Table {
     readonly config = injectFlowbiteTableConfig();

-    readonly tableHead = input<TemplateRef<unknown>>();
-    readonly tableBody = input<TemplateRef<unknown>>();
-    readonly data = input<unknown[]>();
-    readonly tableFoot = input<TemplateRef<unknown>>();
+    readonly tableHead = input<TemplateRef<unknown> | null>(null);
+    readonly tableBody = input<TemplateRef<unknown> | null>(null);
+    readonly data = input<unknown[]>([]);
+    readonly tableFoot = input<TemplateRef<unknown> | null>(null);

     /**
      * @see {@link injectFlowbiteTableConfig}
      */
     readonly color = input(this.config.color);
libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (1)

16-16: Drop empty hostDirectives for cleanliness

Same as the Table component, this empty array is a no-op.

-  hostDirectives: [],
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1639131 and 1fad27b.

📒 Files selected for processing (28)
  • .vscode/settings.json (1 hunks)
  • apps/docs/docs/components/table/_default.component.html (1 hunks)
  • apps/docs/docs/components/table/_default.component.ts (1 hunks)
  • apps/docs/docs/components/table/index.md (1 hunks)
  • apps/docs/docs/components/table/ng-doc.page.ts (1 hunks)
  • apps/docs/docs/ng-doc.api.ts (1 hunks)
  • apps/storybook/src/table.component.stories.ts (1 hunks)
  • libs/flowbite-angular/table/README.md (1 hunks)
  • libs/flowbite-angular/table/ng-package.json (1 hunks)
  • libs/flowbite-angular/table/src/config/table-body-config.ts (1 hunks)
  • libs/flowbite-angular/table/src/config/table-config.ts (1 hunks)
  • libs/flowbite-angular/table/src/config/table-foot-config.ts (1 hunks)
  • libs/flowbite-angular/table/src/config/table-head-config.ts (1 hunks)
  • libs/flowbite-angular/table/src/index.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-body/table-body-state.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-body/table-body.directive.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-body/theme.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-foot/table-foot-state.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-foot/theme.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-head/table-head-state.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-head/table-head.directive.ts (1 hunks)
  • libs/flowbite-angular/table/src/table-head/theme.ts (1 hunks)
  • libs/flowbite-angular/table/src/table/table-state.ts (1 hunks)
  • libs/flowbite-angular/table/src/table/table.component.ts (1 hunks)
  • libs/flowbite-angular/table/src/table/theme.ts (1 hunks)
  • libs/tools/src/generators/component/files/component/__directoryName__/src/__fileName__/__fileName__-state.ts.template (1 hunks)
  • tsconfig.base.json (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: MGREMY
PR: themesberg/flowbite-angular#110
File: apps/docs/docs/components/navbar/directive/_responsive.component.html:4-8
Timestamp: 2025-01-22T14:58:55.257Z
Learning: The `flowbite-navbar-toggle` directive in flowbite-angular:
1. Automatically includes a hamburger menu icon through its internal `flowbite-icon` component
2. Uses a theme-compatible SVG icon that adapts to the current color scheme using `currentColor`
3. Can be used both as a standalone element (`<flowbite-navbar-toggle>`) and as a directive on button elements (`<button flowbite-navbar-toggle>`)
4. Internally handles the click event to toggle the navbar's visibility
Learnt from: MGREMY
PR: themesberg/flowbite-angular#110
File: apps/docs/docs/components/navbar/directive/_responsive.component.html:4-8
Timestamp: 2025-01-22T14:58:55.257Z
Learning: The `flowbite-navbar-toggle` directive in flowbite-angular:
1. Automatically includes a hamburger menu icon through its internal `flowbite-icon` component
2. Can be used both as a standalone element (`<flowbite-navbar-toggle>`) and as a directive on button elements (`<button flowbite-navbar-toggle>`)
3. Internally handles the click event to toggle the navbar's visibility
📚 Learning: 2025-01-22T14:58:55.257Z
Learnt from: MGREMY
PR: themesberg/flowbite-angular#110
File: apps/docs/docs/components/navbar/directive/_responsive.component.html:4-8
Timestamp: 2025-01-22T14:58:55.257Z
Learning: The `flowbite-navbar-toggle` directive in flowbite-angular:
1. Automatically includes a hamburger menu icon through its internal `flowbite-icon` component
2. Can be used both as a standalone element (`<flowbite-navbar-toggle>`) and as a directive on button elements (`<button flowbite-navbar-toggle>`)
3. Internally handles the click event to toggle the navbar's visibility

Applied to files:

  • libs/flowbite-angular/table/README.md
📚 Learning: 2025-01-22T14:58:55.257Z
Learnt from: MGREMY
PR: themesberg/flowbite-angular#110
File: apps/docs/docs/components/navbar/directive/_responsive.component.html:4-8
Timestamp: 2025-01-22T14:58:55.257Z
Learning: The `flowbite-navbar-toggle` directive in flowbite-angular:
1. Automatically includes a hamburger menu icon through its internal `flowbite-icon` component
2. Uses a theme-compatible SVG icon that adapts to the current color scheme using `currentColor`
3. Can be used both as a standalone element (`<flowbite-navbar-toggle>`) and as a directive on button elements (`<button flowbite-navbar-toggle>`)
4. Internally handles the click event to toggle the navbar's visibility

Applied to files:

  • libs/flowbite-angular/table/README.md
📚 Learning: 2025-01-07T20:25:20.823Z
Learnt from: MGREMY
PR: themesberg/flowbite-angular#108
File: libs/flowbite-angular/badge/badge.theme.ts:19-22
Timestamp: 2025-01-07T20:25:20.823Z
Learning: In Flowbite Angular, interfaces like `BadgeColors` that extend color types (e.g., `FlowbiteStandardColors`) intentionally include an index signature `[key: string]` to allow users to define their own custom color keys in the configuration.

Applied to files:

  • libs/flowbite-angular/table/src/table-head/theme.ts
  • libs/flowbite-angular/table/src/table-body/theme.ts
  • libs/flowbite-angular/table/src/table-foot/theme.ts
  • libs/flowbite-angular/table/src/table/theme.ts
📚 Learning: 2024-11-15T08:18:09.828Z
Learnt from: MGREMY
PR: themesberg/flowbite-angular#79
File: libs/flowbite-angular/README.md:87-92
Timestamp: 2024-11-15T08:18:09.828Z
Learning: In `libs/flowbite-angular/README.md`, components that are not yet built should retain their old documentation links and construction emojis until they are completed.

Applied to files:

  • apps/docs/docs/components/table/_default.component.html
📚 Learning: 2025-01-22T14:56:33.543Z
Learnt from: MGREMY
PR: themesberg/flowbite-angular#110
File: apps/docs/docs/components/navbar/directive/_responsive.component.html:10-14
Timestamp: 2025-01-22T14:56:33.543Z
Learning: The `flowbite-navbar-content` component in flowbite-angular uses `<ul>` as its root element, so `<li>` elements can be placed directly inside it without an additional wrapping `<ul>` element.

Applied to files:

  • apps/docs/docs/components/table/_default.component.html
🧬 Code Graph Analysis (10)
libs/flowbite-angular/table/src/table-head/theme.ts (1)
libs/flowbite-angular/table/src/table/theme.ts (1)
  • FlowbiteTableColors (4-7)
libs/flowbite-angular/table/src/config/table-config.ts (1)
libs/flowbite-angular/table/src/table/theme.ts (1)
  • FlowbiteTableColors (4-7)
apps/docs/docs/components/table/ng-doc.page.ts (1)
libs/flowbite-angular/table/src/table-body/theme.ts (1)
  • flowbiteTableBodyTheme (14-44)
libs/flowbite-angular/table/src/config/table-body-config.ts (1)
libs/flowbite-angular/table/src/table-body/theme.ts (2)
  • FlowbiteTableBodyTheme (5-7)
  • flowbiteTableBodyTheme (14-44)
libs/flowbite-angular/table/src/table-body/table-body.directive.ts (4)
libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (1)
  • Directive (10-46)
libs/flowbite-angular/table/src/table-head/table-head.directive.ts (1)
  • Directive (10-46)
libs/flowbite-angular/table/src/table-body/table-body-state.ts (2)
  • provideFlowbiteTableBodyState (11-11)
  • flowbiteTableBodyState (13-13)
libs/flowbite-angular/table/src/config/table-body-config.ts (1)
  • injectFlowbiteTableBodyConfig (48-49)
libs/flowbite-angular/table/src/table-body/theme.ts (1)
libs/flowbite-angular/table/src/table/theme.ts (1)
  • FlowbiteTableColors (4-7)
apps/storybook/src/table.component.stories.ts (1)
libs/flowbite-angular/table/src/config/table-config.ts (1)
  • defaultFlowbiteTableConfig (28-33)
libs/flowbite-angular/table/src/table-foot/theme.ts (1)
libs/flowbite-angular/table/src/table/theme.ts (1)
  • FlowbiteTableColors (4-7)
libs/flowbite-angular/table/src/table-head/table-head.directive.ts (2)
libs/flowbite-angular/table/src/table-body/table-body.directive.ts (1)
  • Directive (10-49)
libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (1)
  • Directive (10-46)
libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (1)
libs/flowbite-angular/table/src/table-foot/table-foot-state.ts (2)
  • provideFlowbiteTableFootState (11-11)
  • flowbiteTableFootState (13-13)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build code 🛠 (20)
🔇 Additional comments (29)
libs/flowbite-angular/table/README.md (1)

1-4: Add a minimal usage snippet for the new secondary entry point

Include a short “Usage” section in libs/flowbite-angular/table/README.md showing how to import and consume the standalone components/directives you just exported:

## Usage

```ts
import { Component } from '@angular/core';
import {
  TableComponent,
  TableHeadDirective,
  TableBodyDirective,
  TableFootDirective
} from 'flowbite-angular/table';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [
    TableComponent,
    TableHeadDirective,
    TableBodyDirective,
    TableFootDirective
  ],
  template: `
    <fb-table [data]="rows">
      <fb-table-head>
        <!-- header cells -->
      </fb-table-head>
      <fb-table-body>
        <!-- body rows -->
      </fb-table-body>
      <fb-table-foot>
        <!-- footer cells -->
      </fb-table-foot>
    </fb-table>
  `
})
export class AppComponent {
  rows = [
    { id: 1, name: 'Alice' },
    { id: 2, name: 'Bob' }
  ];
}
This quick example shows how to import the new secondary‐entry exports and use them in a standalone component.

</details>
<details>
<summary>libs/flowbite-angular/table/ng-package.json (1)</summary>

`1-5`: **ng-packagr entry file looks correct**

Points the secondary entry point to src/index.ts, which aligns with the barrel/public API pattern. No issues spotted.

</details>
<details>
<summary>libs/flowbite-angular/table/src/table/theme.ts (1)</summary>

`4-16`: **Good use of extensible color interface with index signature**

Extending `Pick<FlowbiteColors, ...>` and adding `[key: string]: ColorToTheme` matches the established pattern to allow custom colors in config. This is consistent with prior components.

</details>
<details>
<summary>libs/flowbite-angular/table/src/table-foot/theme.ts (1)</summary>

`1-12`: **Typed theme and color contract look correct**

Using FlowbiteTableColors (with index signature) and a typed createTheme assignment aligns with the library’s extensible theming pattern.

</details>
<details>
<summary>tsconfig.base.json (1)</summary>

`91-91`: **Path alias verified for new table entry point**  
- Confirmed that `libs/flowbite-angular/table/src/index.ts` exists.  
- Alias `"flowbite-angular/table": ["libs/flowbite-angular/table/src/index.ts"]` is correct and consistent with existing entries.

</details>
<details>
<summary>apps/docs/docs/components/table/index.md (1)</summary>

`7-7`: **Demo Key Verification**  
- Confirmed ‘flowbiteDefaultComponent’ exists in apps/docs/docs/components/table/ng-doc.page.ts (line 23). No changes needed.

</details>
<details>
<summary>apps/docs/docs/ng-doc.api.ts (1)</summary>

`34-35`: **LGTM: exposes the Table API to the docs scope**

The new include path integrates the table package into the API reference as expected.

</details>
<details>
<summary>apps/docs/docs/components/table/_default.component.ts (1)</summary>

`5-11`: **Missing `standalone: true` in component metadata**

You’re using the `imports` array which only works for standalone components. Without `standalone: true`, this won’t compile.


Apply this diff:

```diff
 @Component({
-  imports: [Table, TableBody, TableFoot, TableHead],
+  standalone: true,
+  imports: [Table, TableBody, TableFoot, TableHead],
   templateUrl: './_default.component.html',
   host: {
     class: 'flex flex-wrap flex-row gap-3 p-6',
   },
 })
⛔ Skipped due to learnings
Learnt from: MGREMY
PR: themesberg/flowbite-angular#100
File: apps/docs/docs/components/badge/_bordered.component.ts:5-12
Timestamp: 2024-12-19T10:29:39.292Z
Learning: In Angular 19, the standalone property is the default behavior, making the explicit declaration of "standalone: true" unnecessary.
apps/docs/docs/components/table/ng-doc.page.ts (1)

18-35: Docs page wiring looks solid

Demos and themes are correctly wired; toIndentedJson outputs are aligned with the theming objects. No issues spotted.

libs/flowbite-angular/table/src/table-body/table-body-state.ts (2)

1-1: Good call using a type-only import to avoid circular deps at runtime

Using import type { TableBody } ... prevents a runtime cycle with the directive while keeping types intact.


10-13: State token/provider/injector wiring looks correct and consistent

The token name is specific, and the trio provide*/inject*/createState pattern aligns with the other table parts and is DI-friendly.

libs/flowbite-angular/table/src/table-head/table-head-state.ts (2)

1-1: Type-only import avoids runtime circular dependency

Same positive pattern as body/foot/table; safe at runtime while keeping typings.


10-13: Consistent DI/state pattern for TableHead

Token naming and helpers are aligned with the other table parts; good for maintainability.

libs/flowbite-angular/table/src/table/table-state.ts (3)

1-1: Type-only import for Table component is correct

Prevents runtime import cycles between state and component.


10-13: State token/provider/injector are set up correctly for the main Table

Naming, token scoping, and helper exports are consistent with head/body/foot.


1-14: Integration verified: All checks passed

  • The ng-primitives dependency is declared in package.json.
  • Each table directive/component provides and injects its corresponding state helpers.
  • The barrel export (libs/flowbite-angular/table/src/index.ts) includes all state modules and their themes.
  • The flowbite-angular/table path alias is configured in tsconfig.base.json.
libs/flowbite-angular/table/src/table-head/theme.ts (1)

1-12: Theme shape and typings look solid

  • The FlowbiteTableHeadTheme/FlowbiteTableHeadHostTheme structure is clear.
  • FlowbiteTableColors (with index signature per prior components) gives flexibility for custom palette keys.
libs/flowbite-angular/table/src/table-foot/table-foot-state.ts (2)

1-1: Type-only import to prevent runtime cycles — good

Keeps the foot directive/state relationship safe.


10-13: Foot state token/provider/injector are correctly defined

Consistent with head/body/table; naming and token label are clear.

libs/flowbite-angular/table/src/config/table-head-config.ts (1)

48-49: Good DI fallback pattern

Optional inject with a sane default keeps the directive usable even without explicit providers.

libs/flowbite-angular/table/src/table-body/theme.ts (1)

14-44: Confirm Tailwind Support for data-striped Variants

I didn’t find any Tailwind config files or custom plugin calls enabling data-striped:odd/data-striped:even variants in the repo. Please verify that your tailwind.config.{js,cjs,ts} includes the necessary setup—either via an arbitrary-variant enablement or a plugin—so that these classes are compiled. Otherwise, the striped-row styles won’t be applied.

• No tailwind.config.* detected at repo root or in libs/flowbite-angular.
• No addVariant('data-striped'…) or similar plugin usage found.

Example plugin snippet for reference:

// tailwind.config.js
const plugin = require('tailwindcss/plugin');
module.exports = {
  // …
  plugins: [
    plugin(({ addVariant }) => {
      addVariant('data-striped-odd', '&[data-striped="odd"]');
      addVariant('data-striped-even', '&[data-striped="even"]');
    }),
    // other plugins…
  ],
};
libs/flowbite-angular/table/src/config/table-body-config.ts (1)

48-49: Solid defaulting via optional inject

Consistent with the rest of the table configs and keeps usage ergonomic.

libs/flowbite-angular/table/src/config/table-foot-config.ts (1)

48-49: Nice: optional injection with default

Keeps the foot directive functional without extra wiring.

libs/flowbite-angular/table/src/table/table.component.ts (2)

67-78: Theme computation and Tailwind class merging look solid

Merging baseTheme with customTheme and then applying colorToTheme with twMerge is clean and consistent with other components.


32-36: Peer dependencies already require Angular ≥17
The libs/flowbite-angular/package.json declares

  • "@angular/core": ">=20.0.0 <21.0.0"
    which satisfies the Angular 17+ requirement for the @for control‐flow directive. No changes needed.
libs/flowbite-angular/table/src/index.ts (2)

1-27: Barrel exports organization looks good

Clear grouping and public API surface for Table, Head, Body, Foot, and configs. This should make the secondary entry point straightforward to consume.


1-27: Exports sanity check passed

All re-export paths in libs/flowbite-angular/table/src/index.ts resolve to actual files—no missing targets found.

libs/flowbite-angular/table/src/table-foot/table-foot.directive.ts (2)

29-40: LGTM: Theme merge + color application mirrors head/body

Merging baseTheme with per-foot customTheme and deriving classes via colorToTheme ensures consistent theming across sections.


21-27: Nice: DI-backed config input for customTheme

Binding customTheme to the config default via input(this.config.customTheme) aligns with the library pattern.

@MGREMY MGREMY merged commit 3aaf641 into main Aug 17, 2025
6 of 8 checks passed
@MGREMY MGREMY deleted the feat/table branch August 17, 2025 20:07
MGREMY added a commit that referenced this pull request Aug 17, 2025
* feat(table): create table component
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.

2 participants