Skip to content

feat(Separator): add position prop#6415

Merged
benjamincanac merged 6 commits into
nuxt:v4from
zAlweNy26:feat/separator-label-align
May 5, 2026
Merged

feat(Separator): add position prop#6415
benjamincanac merged 6 commits into
nuxt:v4from
zAlweNy26:feat/separator-label-align

Conversation

@zAlweNy26
Copy link
Copy Markdown
Contributor

@zAlweNy26 zAlweNy26 commented May 3, 2026

🔗 Linked issue

Resolves #6367

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

As mentioned in the issue, I’ve added a position prop so that the Separator container (be it a label, an icon or an avatar) can be placed at the start or the end.
I called it "position" to match other props like the Chip and Toaster ones.

Would you like to remove the start/end margins based on the position? Let me know if you prefer that.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@zAlweNy26 zAlweNy26 requested a review from benjamincanac as a code owner May 3, 2026 12:22
@github-actions github-actions Bot added the v4 #4488 label May 3, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c3e1c11a-08ad-4165-addd-e9f7dd89f4f7

📥 Commits

Reviewing files that changed from the base of the PR and between a478495 and f364791.

⛔ Files ignored due to path filters (4)
  • test/components/__snapshots__/AuthForm-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/AuthForm.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/Separator-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/Separator.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (2)
  • src/runtime/components/Separator.vue
  • src/theme/separator.ts
✅ Files skipped from review due to trivial changes (1)
  • src/runtime/components/Separator.vue
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/theme/separator.ts

📝 Walkthrough

Walkthrough

Adds a position prop to the Separator component with values start, center (default), and end. Component props and computed UI now include position; a reusable container template is used to place middle content (label/icon/avatar/slot) at the requested position and border rendering is adjusted for center placement. Theme introduces a position variant and compoundVariants to apply orientation-specific spacing. Docs add a "Position" section and example. Playground demo shows start/end examples. Tests add render cases for position: 'start' and position: 'end'.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main feature added: a new position prop for the Separator component.
Description check ✅ Passed The description clearly explains the change (adding a position prop), references the linked issue, and provides context about the implementation.
Linked Issues check ✅ Passed The PR implements the core requirement from #6367 to support label alignment (start, center, end) for the Separator component across orientations.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the position prop feature across component code, theme, documentation, and tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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
Copy Markdown
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)
test/components/Separator.spec.ts (1)

16-17: ⚡ Quick win

Add explicit structure assertions for position behavior.

These new cases are useful smoke tests, but they don’t verify placement semantics. Add assertions for DOM order/count (e.g., start container before border, end after border, center with two borders), including vertical orientation variants.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/components/Separator.spec.ts` around lines 16 - 17, Update the
Separator.spec.ts tests that add cases 'with position start' and 'with position
end' to include explicit DOM structure assertions: render the Separator
component for positions 'start', 'end', and 'center' (and repeat for vertical
orientation) and assert the placement and counts—verify for 'start' the content
container appears before the border element, for 'end' the content container
appears after the border element, and for 'center' there are two border elements
surrounding the content; use the test helpers/selectors already in the file to
locate the content container and border elements (the test titles 'with position
start', 'with position end' and the component name Separator should help you
find where to add these assertions).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/content/docs/2.components/separator.md`:
- Line 50: The new "### Position" heading is missing the unreleased-feature
badge; update the heading by adding :badge{label="Soon" class="align-text-top"}
immediately after the "Position" heading text so the docs show the Soon badge
(i.e., change the "### Position" heading to include the badge markup right after
the heading title).

In `@src/runtime/components/Separator.vue`:
- Around line 67-70: The component reads props.position directly for runtime
branching; replace that by resolving variants with
useResolvedVariants('separator', props, theme, ['position']) and use the
resolved value for all v-if/computed branching (e.g., where props.position is
used around the current orientation/defaults and at the other noted spots).
Specifically, call useResolvedVariants with the 'separator' key and the existing
props/theme, extract the resolved position value, and update any v-if or
computed checks that reference props.position (including the locations around
the current orientation handling and the blocks previously at lines ~84 and
~100-110) to use the resolved position so runtime logic follows theme/app-config
variant resolution.

In `@src/theme/separator.ts`:
- Around line 37-41: The position variants in src/theme/separator.ts define
start/center/end but leave start/end empty so separators always use symmetric
spacing (mx-3 / my-2); update the separator theme to produce true edge alignment
by giving position.start and position.end concrete spacing tokens (and combine
them with the orientation variants). Specifically, for horizontal orientation
(the separator's orientation variant) make position.start set left margin to 0
and right margin to the existing spacing (e.g., ml-0 + mr-3) and position.end
set right margin 0 and left margin the spacing (mr-0 + ml-3); for vertical
orientation invert to mt/mb equivalents (mt-0 + mb-2 for start, mb-0 + mt-2 for
end). Modify the position object (and/or create orientation+position compound
variants) around the existing position definition so start/center/end produce
the intended edge-aligned margins instead of empty strings.

---

Nitpick comments:
In `@test/components/Separator.spec.ts`:
- Around line 16-17: Update the Separator.spec.ts tests that add cases 'with
position start' and 'with position end' to include explicit DOM structure
assertions: render the Separator component for positions 'start', 'end', and
'center' (and repeat for vertical orientation) and assert the placement and
counts—verify for 'start' the content container appears before the border
element, for 'end' the content container appears after the border element, and
for 'center' there are two border elements surrounding the content; use the test
helpers/selectors already in the file to locate the content container and border
elements (the test titles 'with position start', 'with position end' and the
component name Separator should help you find where to add these assertions).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3e05b795-9887-4577-9162-7a78583ba389

📥 Commits

Reviewing files that changed from the base of the PR and between 6e96375 and 2ec33b7.

⛔ Files ignored due to path filters (4)
  • test/components/__snapshots__/AuthForm-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/AuthForm.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/Separator-vue.spec.ts.snap is excluded by !**/*.snap
  • test/components/__snapshots__/Separator.spec.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (5)
  • docs/content/docs/2.components/separator.md
  • playgrounds/nuxt/app/pages/components/separator.vue
  • src/runtime/components/Separator.vue
  • src/theme/separator.ts
  • test/components/Separator.spec.ts

Comment thread docs/content/docs/2.components/separator.md Outdated
Comment thread src/runtime/components/Separator.vue Outdated
Comment thread src/theme/separator.ts
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 3, 2026

npm i https://pkg.pr.new/@nuxt/ui@6415

commit: f364791

@benjamincanac benjamincanac changed the title feat(Separator): add content position prop feat(Separator): add position prop May 5, 2026
Copy link
Copy Markdown
Member

@benjamincanac benjamincanac left a comment

Choose a reason for hiding this comment

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

Thanks! 😊

@benjamincanac benjamincanac merged commit 844660a into nuxt:v4 May 5, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

USeparator: Add label alignment props

2 participants