Skip to content

Commit ddbd113

Browse files
committed
fix: address PR feedback for Show component docs
- Fix react-router and tanstack Feature examples using plan instead of feature - Add 'signed-out' to when prop type definition - Standardize Astro/Vue/Nuxt examples to use when prop instead of shorthand - Replace condition prop with when for callback function examples
1 parent 80b94ee commit ddbd113

File tree

1 file changed

+16
-16
lines changed
  • docs/reference/components/control

1 file changed

+16
-16
lines changed

docs/reference/components/control/show.mdx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ The following example demonstrates how to use the `<Show />` component to protec
411411
import { Show } from '@clerk/astro/components'
412412
---
413413
414-
<Show role="org:billing">
414+
<Show when={{ role: 'org:billing' }}>
415415
<p slot="fallback">Only a member of the Billing department can access this content.</p>
416416
<p>Users with Role org:billing can see this.</p>
417417
</Show>
@@ -516,7 +516,7 @@ The following example demonstrates how to use the `<Show />` component to protec
516516
</script>
517517
518518
<template>
519-
<Show role="org:billing">
519+
<Show :when="{ role: 'org:billing' }">
520520
<template #fallback>
521521
<p>Only a member of the Billing department can access this content.</p>
522522
</template>
@@ -533,7 +533,7 @@ The following example demonstrates how to use the `<Show />` component to protec
533533
</script>
534534
535535
<template>
536-
<Show role="org:billing">
536+
<Show :when="{ role: 'org:billing' }">
537537
<template #fallback>
538538
<p>Only a member of the Billing department can access this content.</p>
539539
</template>
@@ -589,7 +589,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
589589
import { Show } from '@clerk/astro/components'
590590
---
591591
592-
<Show plan="bronze">
592+
<Show when={{ plan: 'bronze' }}>
593593
<p slot="fallback">Sorry, only subscribers to the Bronze plan can access this content.</p>
594594
<p>Welcome, Bronze subscriber!</p>
595595
</Show>
@@ -694,7 +694,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
694694
</script>
695695
696696
<template>
697-
<Show plan="bronze">
697+
<Show :when="{ plan: 'bronze' }">
698698
<template #fallback>
699699
<p>Sorry, only subscribers to the Bronze plan can access this content.</p>
700700
</template>
@@ -711,7 +711,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
711711
</script>
712712
713713
<template>
714-
<Show plan="bronze">
714+
<Show :when="{ plan: 'bronze' }">
715715
<template #fallback>
716716
<p>Sorry, only subscribers to the Bronze plan can access this content.</p>
717717
</template>
@@ -771,7 +771,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
771771
import { Show } from '@clerk/astro/components'
772772
---
773773
774-
<Show feature="premium_access">
774+
<Show when={{ feature: 'premium_access' }}>
775775
<p slot="fallback">
776776
Sorry, only subscribers with the Premium Access feature can access this content.
777777
</p>
@@ -847,7 +847,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
847847
export default function PremiumAccessPage() {
848848
return (
849849
<Show
850-
plan="premium_access"
850+
when={{ feature: 'premium_access' }}
851851
fallback={
852852
<p>Sorry, only subscribers with the Premium Access feature can access this content.</p>
853853
}
@@ -871,7 +871,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
871871
function PremiumAccessPage() {
872872
return (
873873
<Show
874-
plan="premium_access"
874+
when={{ feature: 'premium_access' }}
875875
fallback={
876876
<p>Sorry, only subscribers with the Premium Access feature can access this content.</p>
877877
}
@@ -890,7 +890,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
890890
</script>
891891
892892
<template>
893-
<Show feature="premium_access">
893+
<Show :when="{ feature: 'premium_access' }">
894894
<template #fallback>
895895
<p>Sorry, only subscribers with the Premium Access feature can access this content.</p>
896896
</template>
@@ -907,7 +907,7 @@ The following example demonstrates how to use `<Show />` to protect content by c
907907
</script>
908908
909909
<template>
910-
<Show feature="premium_access">
910+
<Show :when="{ feature: 'premium_access' }">
911911
<template #fallback>
912912
<p>Sorry, only subscribers with the Premium Access feature can access this content.</p>
913913
</template>
@@ -964,7 +964,7 @@ The following example uses `<Show>`'s `when` prop with a callback function to co
964964
import { Show } from '@clerk/astro/components'
965965
---
966966
967-
<Show condition={(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })}>
967+
<Show when={(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })}>
968968
<p slot="fallback">Only an Admin or Billing Manager can access this content.</p>
969969
<p>The settings page.</p>
970970
</Show>
@@ -1069,7 +1069,7 @@ The following example uses `<Show>`'s `when` prop with a callback function to co
10691069
</script>
10701070
10711071
<template>
1072-
<Show :condition="(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })">
1072+
<Show :when="(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })">
10731073
<template #fallback>
10741074
<p>Only an Admin or Billing Manager can access this content.</p>
10751075
</template>
@@ -1086,7 +1086,7 @@ The following example uses `<Show>`'s `when` prop with a callback function to co
10861086
</script>
10871087
10881088
<template>
1089-
<Show :condition="(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })">
1089+
<Show :when="(has) => has({ role: 'org:admin' }) || has({ role: 'org:billing_manager' })">
10901090
<template #fallback>
10911091
<p>Only an Admin or Billing Manager can access this content.</p>
10921092
</template>
@@ -1114,7 +1114,7 @@ The following example uses `<Show>`'s `when` prop with a callback function to co
11141114
---
11151115

11161116
- `when`
1117-
- `'signed-in' | { feature: string } | { permission: string } | { plan: string } | { role: string } | (has) => boolean`
1117+
- `'signed-in' | 'signed-out' | { feature: string } | { permission: string } | { plan: string } | { role: string } | (has) => boolean`
11181118

1119-
Determines when to render the children. Can be `'signed-in'` for authentication checks, an object with a [Feature](/docs/guides/billing/overview), [Permission](/docs/guides/organizations/control-access/roles-and-permissions), [Plan](/docs/guides/billing/overview), or [Role](/docs/guides/organizations/control-access/roles-and-permissions) for authorization checks, or a callback function for custom conditional logic.
1119+
Determines when to render the children. Can be `'signed-in'` or `'signed-out'` for authentication checks, an object with a [Feature](/docs/guides/billing/overview), [Permission](/docs/guides/organizations/control-access/roles-and-permissions), [Plan](/docs/guides/billing/overview), or [Role](/docs/guides/organizations/control-access/roles-and-permissions) for authorization checks, or a callback function for custom conditional logic.
11201120
</Properties>

0 commit comments

Comments
 (0)