Skip to content

Inject id & classes into components#21

Merged
brionmario merged 2 commits into
thunder-id:mainfrom
brionmario:migrate
Jul 9, 2026
Merged

Inject id & classes into components#21
brionmario merged 2 commits into
thunder-id:mainfrom
brionmario:migrate

Conversation

@brionmario

@brionmario brionmario commented Jul 9, 2026

Copy link
Copy Markdown
Member

Purpose

Adds support for Element IDs and CSS Classes arriving in the flow response, and applies them to the rendered SDK components across frameworks.

Approach

  • embedded-flow.ts model: added id/classes fields to the flow component schema.
  • React: FieldFactory, AuthOptionFactory, BaseSignIn, BaseSignUp, FormControl, and Typography now read and forward id/className from the flow config to the rendered DOM elements.
  • Vue: Button and TextField primitives updated to accept and apply the same props.
  • Nuxt: SignInButton, SignOutButton, SignUpButton updated to pass through id/classes.
  • Next.js: SignIn presentation component updated accordingly.
  • Minor: renamed a GitHub Actions workflow to "Release" for naming consistency.

Related Issues

Related PRs

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided. (Add links if there are any)
  • Tests provided. (Add links if there are any)
    • Unit Tests
    • Integration Tests
  • Breaking changes. (Fill if applicable)
    • Breaking changes section filled.
    • breaking change label added.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@brionmario, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b905f151-01b3-4db2-b542-d204ac8946b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1cb26a4 and a2449e0.

📒 Files selected for processing (14)
  • .github/workflows/release.yml
  • packages/javascript/src/models/embedded-flow.ts
  • packages/nextjs/src/client/components/presentation/SignIn/SignIn.tsx
  • packages/nuxt/src/runtime/components/actions/SignInButton.ts
  • packages/nuxt/src/runtime/components/actions/SignOutButton.ts
  • packages/nuxt/src/runtime/components/actions/SignUpButton.ts
  • packages/react/src/components/factories/FieldFactory.tsx
  • packages/react/src/components/presentation/auth/AuthOptionFactory.tsx
  • packages/react/src/components/presentation/auth/SignIn/BaseSignIn.tsx
  • packages/react/src/components/presentation/auth/SignUp/BaseSignUp.tsx
  • packages/react/src/components/primitives/FormControl/FormControl.tsx
  • packages/react/src/components/primitives/Typography/Typography.tsx
  • packages/vue/src/components/primitives/Button/Button.ts
  • packages/vue/src/components/primitives/TextField/TextField.ts
📝 Walkthrough

Walkthrough

Adds optional id and classes support across the SDK: the embedded flow model gains action and classes fields, and React, Vue, Nuxt, and Next.js primitive/presentation components (buttons, inputs, form controls, typography, sign-in/sign-up cards) forward id/classes to rendered DOM elements. A release workflow name is also updated.

Changes

Id and classes propagation

Layer / File(s) Summary
Embedded flow model contract
packages/javascript/src/models/embedded-flow.ts
EmbeddedFlowComponent gains optional action (with ref and index signature) and classes string fields.
React field factory id support
packages/react/src/components/factories/FieldFactory.tsx
FieldConfig adds an optional id, destructured and forwarded via commonProps in createField.
AuthOptionFactory id/classes wiring
packages/react/src/components/presentation/auth/AuthOptionFactory.tsx
Imports cx and applies merged className plus id={component.id} across text/OTP inputs, social/action buttons, Text, Select, DateInput, Block, and Stack.
React primitives id support
packages/react/src/components/primitives/FormControl/FormControl.tsx, packages/react/src/components/primitives/Typography/Typography.tsx
FormControlProps and TypographyProps add optional id, applied to rendered root elements.
BaseSignIn id prop wiring
packages/react/src/components/presentation/auth/SignIn/BaseSignIn.tsx
BaseSignInProps adds optional id, applied to the root div and CardPrimitive wrappers across loading, empty, and default states.
BaseSignUp id prop wiring
packages/react/src/components/presentation/auth/SignUp/BaseSignUp.tsx
BaseSignUpProps adds optional id, applied to render-props div and CardPrimitive wrappers.
Next.js SignIn id passthrough
packages/nextjs/src/client/components/presentation/SignIn/SignIn.tsx
SignInProps now picks id from BaseSignInProps.
Nuxt action buttons id forwarding
packages/nuxt/src/runtime/components/actions/SignInButton.ts, SignOutButton.ts, SignUpButton.ts
Each button forwards attrs.id to its underlying Base button component.
Vue Button and TextField id support
packages/vue/src/components/primitives/Button/Button.ts, packages/vue/src/components/primitives/TextField/TextField.ts
Button forwards attrs['id']; TextField adds an id prop used for label for and input id, falling back to name.

Release Workflow Name Update

Layer / File(s) Summary
Workflow name change
.github/workflows/release.yml
The workflow's top-level name value is updated.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Suggested reviewers: ThaminduDilshan

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: adding id and classes support to SDK components.
Description check ✅ Passed The description follows the template with Purpose, Approach, Related Issues/PRs, Checklist, and Security checks filled in.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/vue/src/components/primitives/Button/Button.ts (1)

79-79: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider declaring id as a typed prop for consistency with TextField.

Button accesses id via attrs['id'] (untyped, unknown), while TextField declares id as a proper String prop with type safety. This inconsistency means TypeScript consumers of Button won't get autocomplete or validation for the id prop. Declaring id in the props config and ButtonProps type would align both components and improve type safety.

♻️ Suggested refactor: declare `id` as a prop
 type ButtonProps = Readonly<{
   color: 'primary' | 'secondary' | 'danger';
   disabled: boolean;
+  id: string | undefined;
   endIcon: VNode | undefined;
   fullWidth: boolean;
   loading: boolean;
   size: 'small' | 'medium' | 'large';
   startIcon: VNode | undefined;
   type: 'button' | 'submit' | 'reset';
   variant: 'solid' | 'outline' | 'ghost' | 'text';
 }>;

And in the props config:

   props: {
     color: {
       default: 'primary',
       type: String as PropType<'primary' | 'secondary' | 'danger'>,
     },
     disabled: {default: false, type: Boolean},
     endIcon: {default: undefined, type: Object as PropType<VNode>},
     fullWidth: {default: false, type: Boolean},
+    id: {default: undefined, type: String},
     loading: {default: false, type: Boolean},

Then update the render:

-          id: attrs['id'],
+          id: props.id,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vue/src/components/primitives/Button/Button.ts` at line 79, Button
currently reads id from attrs['id'], so it is untyped and inconsistent with
TextField. Update the Button component’s props definition and ButtonProps type
to declare id as a proper String prop, then use that typed prop in the Button
render/setup logic instead of pulling it from attrs. Keep the change localized
to the Button component so consumers get autocomplete and validation for id.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/vue/src/components/primitives/Button/Button.ts`:
- Line 79: Button currently reads id from attrs['id'], so it is untyped and
inconsistent with TextField. Update the Button component’s props definition and
ButtonProps type to declare id as a proper String prop, then use that typed prop
in the Button render/setup logic instead of pulling it from attrs. Keep the
change localized to the Button component so consumers get autocomplete and
validation for id.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9e7087a7-c8dd-455a-8782-5cd284876403

📥 Commits

Reviewing files that changed from the base of the PR and between b356f40 and 1cb26a4.

📒 Files selected for processing (14)
  • .github/workflows/release.yml
  • packages/javascript/src/models/embedded-flow.ts
  • packages/nextjs/src/client/components/presentation/SignIn/SignIn.tsx
  • packages/nuxt/src/runtime/components/actions/SignInButton.ts
  • packages/nuxt/src/runtime/components/actions/SignOutButton.ts
  • packages/nuxt/src/runtime/components/actions/SignUpButton.ts
  • packages/react/src/components/factories/FieldFactory.tsx
  • packages/react/src/components/presentation/auth/AuthOptionFactory.tsx
  • packages/react/src/components/presentation/auth/SignIn/BaseSignIn.tsx
  • packages/react/src/components/presentation/auth/SignUp/BaseSignUp.tsx
  • packages/react/src/components/primitives/FormControl/FormControl.tsx
  • packages/react/src/components/primitives/Typography/Typography.tsx
  • packages/vue/src/components/primitives/Button/Button.ts
  • packages/vue/src/components/primitives/TextField/TextField.ts

@brionmario brionmario changed the title Inject id & classes to SDK components Inject id & classes to components Jul 9, 2026
@brionmario brionmario changed the title Inject id & classes to components Inject id & classes into components Jul 9, 2026
@brionmario brionmario merged commit fc24b26 into thunder-id:main Jul 9, 2026
3 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.

2 participants