Skip to content

Commit 294b454

Browse files
committed
fix(ui): Align legal consent checkbox in simple theme
In the simple theme, the legal consent checkbox would display a large square when wrapped to a second line. This is because it's inside a flex container which defaults align to `stretch`. Explicitly set it to `align='start'` to match the behavior of `CheckboxField`. Some other themes don't have this problem because they set an explicit height and width. But that approach doesn't seem appropriate for `simple`. This fix also fixes `neobrutalism` which had the same issue. This doesn't break existing themes because if you already have a height, the default align of `stretch` falls back to `start`. I also verified this visually by checking each theme before and after the change. Also add `simple` to the Sandbox for easy verification of the fix.
1 parent b9eb19d commit 294b454

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

.changeset/fair-singers-consent.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/ui': patch
3+
---
4+
5+
Fix the legal consent checkbox growing in size when its label wraps to a second line while using the `simple` theme. The checkbox is now aligned to the start of the row so it no longer stretches to match the label height.

packages/clerk-js/sandbox/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ async function initControls() {
281281
.addBinding(PARAMS, 'baseTheme', {
282282
options: {
283283
default: '',
284+
clerk: 'clerk',
285+
simple: 'simple',
284286
dark: 'dark',
285287
shadesOfPurple: 'shadesOfPurple',
286288
neobrutalism: 'neobrutalism',
@@ -357,6 +359,8 @@ async function initControls() {
357359
}
358360

359361
const themes: Record<string, unknown> = {
362+
clerk: 'clerk',
363+
simple: 'simple',
360364
dark,
361365
shadesOfPurple,
362366
neobrutalism,

packages/ui/src/elements/LegalConsentCheckbox.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ export const LegalCheckbox = (
7979

8080
return (
8181
<Field.Root {...props}>
82-
<Flex justify='center'>
82+
<Flex
83+
justify='center'
84+
align='start'
85+
>
8386
<Field.CheckboxIndicator
8487
elementDescriptor={descriptors.formFieldCheckboxInput}
8588
elementId={descriptors.formFieldInput.setId('legalAccepted')}

0 commit comments

Comments
 (0)