diff --git a/app.config.ts b/app.config.ts index 40cc443e8a..60ebb7af81 100644 --- a/app.config.ts +++ b/app.config.ts @@ -81,6 +81,55 @@ export default defineConfig( toc: { minDepth: 2, }, + packageManagers: { + presets: { + npm: { + install: "npm i :content", + "install-dev": "npm i :content -D", + "install-global": "npm i :content -g", + "install-local": "npm i", + run: "npm run :content", + exec: "npx :content", + create: "npm init :content", + }, + pnpm: { + install: "pnpm i :content", + "install-dev": "pnpm i :content -D", + "install-global": "pnpm i :content -g", + "install-local": "pnpm i", + run: "pnpm :content", + exec: "pnpx :content", + create: "pnpm create :content", + }, + yarn: { + install: "yarn add :content", + "install-dev": "yarn add :content -D", + "install-global": "yarn add :content -g", + "install-local": "yarn i", + run: "yarn :content", + exec: "yarn dlx :content", + create: "yarn create :content", + }, + bun: { + install: "bun i :content", + "install-dev": "bun i :content -d", + "install-global": "bun i :content -g", + "install-local": "bun i", + run: "bun run :content", + exec: "bunx :content", + create: "bun create :content", + }, + deno: { + install: "deno add npm::content", + "install-dev": "deno add npm::content -D", + "install-global": "deno add npm::content -g", + "install-local": "deno i", + run: "deno run :content", + exec: "dpx :content", + create: "deno run -A npm::content", + }, + }, + }, }, } ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 321fb8cb7f..988d3eb790 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3111,9 +3111,6 @@ packages: mdast-util-find-and-replace@3.0.1: resolution: {integrity: sha512-SG21kZHGC3XRTSUhtofZkBzZTJNM5ecCi0SK2IMKmSXR8vO3peL+kb1O0z7Zl83jKtutG4k5Wv/W7V3/YHvzPA==} - mdast-util-from-markdown@2.0.1: - resolution: {integrity: sha512-aJEUyzZ6TzlsX2s5B4Of7lN7EQtAxvtradMMglCQDyaTFgse6CmtmdJ15ElnVRlCg1vpNyVtbem0PWzlNieZsA==} - mdast-util-from-markdown@2.0.2: resolution: {integrity: sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==} @@ -3135,9 +3132,6 @@ packages: mdast-util-gfm-task-list-item@2.0.0: resolution: {integrity: sha512-IrtvNvjxC1o06taBAVJznEnkiHxLFTzgonUdy8hzFVeDun0uTjxxrRGVaNFqkU1wJR3RBPEfsxmU6jDWPofrTQ==} - mdast-util-gfm@3.0.0: - resolution: {integrity: sha512-dgQEX5Amaq+DuUqf26jJqSK9qgixgd6rYDHAv4aTBuA92cTknZlKpPfa86Z/s8Dj8xsAQpFfBmPUHWJBWqS4Bw==} - mdast-util-gfm@3.1.0: resolution: {integrity: sha512-0ulfdQOM3ysHhCJ1p06l0b0VKlhU0wuQs3thxZQagjcjPrlFRqY215uZGHHJan9GEAXd9MbfPjFJz+qMkVR6zQ==} @@ -5944,7 +5938,7 @@ snapshots: '@solid-primitives/clipboard@1.5.10(solid-js@1.9.5)': dependencies: - '@solid-primitives/utils': 6.2.3(solid-js@1.9.5) + '@solid-primitives/utils': 6.3.0(solid-js@1.9.5) solid-js: 1.9.5 '@solid-primitives/context@0.2.3(solid-js@1.9.5)': @@ -5960,7 +5954,7 @@ snapshots: dependencies: '@solid-primitives/event-listener': 2.3.3(solid-js@1.9.5) '@solid-primitives/rootless': 1.4.5(solid-js@1.9.5) - '@solid-primitives/utils': 6.2.3(solid-js@1.9.5) + '@solid-primitives/utils': 6.3.0(solid-js@1.9.5) solid-js: 1.9.5 '@solid-primitives/keyed@1.2.2(solid-js@1.9.5)': @@ -8037,7 +8031,7 @@ snapshots: '@types/mdast': 4.0.4 '@types/unist': 3.0.3 devlop: 1.1.0 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-to-markdown: 2.1.0 parse-entities: 4.0.1 stringify-entities: 4.0.4 @@ -8052,23 +8046,6 @@ snapshots: unist-util-is: 6.0.0 unist-util-visit-parents: 6.0.1 - mdast-util-from-markdown@2.0.1: - dependencies: - '@types/mdast': 4.0.4 - '@types/unist': 3.0.3 - decode-named-character-reference: 1.0.2 - devlop: 1.1.0 - mdast-util-to-string: 4.0.0 - micromark: 4.0.0 - micromark-util-decode-numeric-character-reference: 2.0.1 - micromark-util-decode-string: 2.0.0 - micromark-util-normalize-identifier: 2.0.0 - micromark-util-symbol: 2.0.0 - micromark-util-types: 2.0.0 - unist-util-stringify-position: 4.0.0 - transitivePeerDependencies: - - supports-color - mdast-util-from-markdown@2.0.2: dependencies: '@types/mdast': 4.0.4 @@ -8091,7 +8068,7 @@ snapshots: '@types/mdast': 4.0.4 devlop: 1.1.0 escape-string-regexp: 5.0.0 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-to-markdown: 2.1.0 micromark-extension-frontmatter: 2.0.0 transitivePeerDependencies: @@ -8142,18 +8119,6 @@ snapshots: transitivePeerDependencies: - supports-color - mdast-util-gfm@3.0.0: - dependencies: - mdast-util-from-markdown: 2.0.1 - mdast-util-gfm-autolink-literal: 2.0.1 - mdast-util-gfm-footnote: 2.0.0 - mdast-util-gfm-strikethrough: 2.0.0 - mdast-util-gfm-table: 2.0.0 - mdast-util-gfm-task-list-item: 2.0.0 - mdast-util-to-markdown: 2.1.0 - transitivePeerDependencies: - - supports-color - mdast-util-gfm@3.1.0: dependencies: mdast-util-from-markdown: 2.0.2 @@ -8172,7 +8137,7 @@ snapshots: '@types/hast': 3.0.4 '@types/mdast': 4.0.4 devlop: 1.1.0 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-to-markdown: 2.1.0 transitivePeerDependencies: - supports-color @@ -8185,7 +8150,7 @@ snapshots: '@types/unist': 3.0.3 ccount: 2.0.1 devlop: 1.1.0 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-to-markdown: 2.1.0 parse-entities: 4.0.1 stringify-entities: 4.0.4 @@ -8196,7 +8161,7 @@ snapshots: mdast-util-mdx@3.0.0: dependencies: - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-mdx-expression: 2.0.1 mdast-util-mdx-jsx: 3.1.3 mdast-util-mdxjs-esm: 2.0.1 @@ -8210,7 +8175,7 @@ snapshots: '@types/hast': 3.0.4 '@types/mdast': 4.0.4 devlop: 1.1.0 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 mdast-util-to-markdown: 2.1.0 transitivePeerDependencies: - supports-color @@ -9197,7 +9162,7 @@ snapshots: remark-gfm@4.0.0: dependencies: '@types/mdast': 4.0.4 - mdast-util-gfm: 3.0.0 + mdast-util-gfm: 3.1.0 micromark-extension-gfm: 3.0.0 remark-parse: 11.0.0 remark-stringify: 11.0.0 @@ -9224,7 +9189,7 @@ snapshots: remark-parse@11.0.0: dependencies: '@types/mdast': 4.0.4 - mdast-util-from-markdown: 2.0.1 + mdast-util-from-markdown: 2.0.2 micromark-util-types: 2.0.0 unified: 11.0.5 transitivePeerDependencies: diff --git a/src/routes/concepts/context.mdx b/src/routes/concepts/context.mdx index 40cb23dd18..7ed8c250d9 100644 --- a/src/routes/concepts/context.mdx +++ b/src/routes/concepts/context.mdx @@ -21,16 +21,13 @@ This offers a way to access state across an application without passing props th Context is created using the [`createContext`](/reference/component-apis/create-context) function. This function has a `Provider` property that wraps the component tree you want to provide context to. - -
-```jsx +```jsx tab title="/context/create.js" import { createContext } from "solid-js"; const MyContext = createContext(); ``` -
-
-```jsx + +```jsx tab title="/context/component.jsx" import { MyContext } from "./create"; export function Provider (props) { @@ -41,8 +38,6 @@ export function Provider (props) { ) }; ``` -
-
## Providing context to children @@ -161,9 +156,7 @@ export function CounterProvider(props) { [Signals](/concepts/signals) offer a way to synchronize and manage data shared across your components using context. You can pass a signal directly to the `value` prop of the `Provider` component, and any changes to the signal will be reflected in all components that consume the context. - -
-```jsx +```jsx tab title="App.jsx" import { CounterProvider } from "./Context"; import { Child } from "./Child"; @@ -176,9 +169,8 @@ export function App() { ) } ``` -
-
-```jsx + +```jsx tab title="Context.jsx" import { createSignal, useContext } from "solid-js"; export function CounterProvider(props) { @@ -204,9 +196,9 @@ export function CounterProvider(props) { export function useCounter() { return useContext(CounterContext); } ``` -
-
-```tsx title="/context/counter-component.tsx" + +```tsx tab title="Child.jsx" +// /context/counter-component.tsx import { useCounter } from "./Context"; export function Child(props) { @@ -221,8 +213,6 @@ export function Child(props) { ); }; ``` -
-
This offers a way to manage state across your components without having to pass props through intermediate elements. @@ -262,12 +252,12 @@ Read more about default values in the [`createContext`](/reference/component-api ::: Because of this, if an initial value was not passed to `createContext`, the TS type signature of `useContext` will indicate that -the value returned might be `undefined` (as mentioned above). -This can be quite annoying when you want to use the context inside a component, and particularly when immediately destructuring the context. +the value returned might be `undefined` (as mentioned above). +This can be quite annoying when you want to use the context inside a component, and particularly when immediately destructuring the context. Additionally, if you use `useContext` and it returns `undefined` (which is often, but not always, the result of a bug), the error message thrown at runtime can be confusing. -The most common solution for it is to wrap all uses of `useContext` in a function that will explicitly throw a helpful error if the context is `undefined`. -This also serves to narrow the type returned, so TS doesn't complain. +The most common solution for it is to wrap all uses of `useContext` in a function that will explicitly throw a helpful error if the context is `undefined`. +This also serves to narrow the type returned, so TS doesn't complain. As an example: ```ts title="/context/counter-component.tsx" @@ -279,4 +269,3 @@ function useCounterContext() { return context } ``` - diff --git a/src/routes/configuration/typescript.mdx b/src/routes/configuration/typescript.mdx index 059120a92c..77440e4b8f 100644 --- a/src/routes/configuration/typescript.mdx +++ b/src/routes/configuration/typescript.mdx @@ -52,59 +52,16 @@ Transitioning from JavaScript to TypeScript in a Solid project offers the benefi 1. Install TypeScript into your project. - -
-```bash frame="none" -npm i --save-dev typescript +```package-install-dev +typescript ``` -
- -
-```bash frame="none" -yarn add --dev typescript -``` -
- -
-```bash frame="none" -pnpm add --save-dev typescript -``` -
- -
-```bash frame="none" -bun add --save-dev typescript -``` -
-
2. Run the following command to generate a `tsconfig.json` file. - -
-```bash frame="none" -npx tsc --init -``` -
-
-```bash frame="none" -yarn dlx tsc --init +```package-exec +tsc --init ``` -
- -
-```bash frame="none" -pnpm tsc --init -``` -
- -
-```bash frame="none" -bunx tsc --init -``` -
-
3. Update the contents of the `tsconfig.json` to match Solid's configuration: @@ -421,9 +378,9 @@ function MyGenericComponent(props: MyProps): JSX.Element { ``` :::info - Each `Component` type has a corresponding `Props` type that defines the shape - of its properties. These `Props` types also accept the same generic types as - their associated `Component` types. +Each `Component` type has a corresponding `Props` type that defines the shape +of its properties. These `Props` types also accept the same generic types as +their associated `Component` types. ::: ### Event handling @@ -523,13 +480,13 @@ return
...
In this case, using `divRef!` within the `ref` attribute signals to TypeScript that `divRef` will receive an assignment after this stage, which is more in line with how Solid works. :::info - While TypeScript does catch incorrect usage of refs that occur before their - JSX block definition, it currently does not identify undefined variables - within certain nested functions in Solid. Therefore, additional care is needed - when using `ref`s in functions such as - [`createMemo`](/reference/basic-reactivity/create-memo), - [`createRenderEffect`](/reference/secondary-primitives/create-render-effect), - and [`createComputed`](/reference/secondary-primitives/create-computed). +While TypeScript does catch incorrect usage of refs that occur before their +JSX block definition, it currently does not identify undefined variables +within certain nested functions in Solid. Therefore, additional care is needed +when using `ref`s in functions such as +[`createMemo`](/reference/basic-reactivity/create-memo), +[`createRenderEffect`](/reference/secondary-primitives/create-render-effect), +and [`createComputed`](/reference/secondary-primitives/create-computed). ::: Finally, a riskier approach involves using the definite assignment assertion right at the point of variable initialization. @@ -584,9 +541,9 @@ return
{user()?.name}
; return (
- {(nonNullishUser) => <> - {nonNullishUser().name} - } + + {(nonNullishUser) => <>{nonNullishUser().name}} +
); ``` @@ -709,7 +666,7 @@ const handler: JSX.EventHandlerWithOptions = { :::info **Note**: -By default, using native events like `mousemove` with the `on` prefix — for example, `
{}} />` — will trigger a TypeScript error. +By default, using native events like `mousemove` with the `on` prefix — for example, `
{}} />` — will trigger a TypeScript error. This occurs because these native events are not part of Solid's custom event type definitions. To solve this, the `CustomEvents` interface can be extended to include events from the `HTMLElementEventMap`: diff --git a/src/routes/guides/deployment-options/aws-via-sst.mdx b/src/routes/guides/deployment-options/aws-via-sst.mdx index 4a59999bd6..3af978a202 100644 --- a/src/routes/guides/deployment-options/aws-via-sst.mdx +++ b/src/routes/guides/deployment-options/aws-via-sst.mdx @@ -4,7 +4,7 @@ order: 1 mainNavExclude: true --- -[SST](https://sst.dev/) is a framework for deploying applications to any cloud provider. It has a built-in way to deploy SolidStart apps to AWS Lambda. For additional details, you can [visit their docs](https://sst.dev/docs/). +[SST](https://sst.dev/) is a framework for deploying applications to any cloud provider. It has a built-in way to deploy SolidStart apps to AWS Lambda. For additional details, you can [visit their docs](https://sst.dev/docs/). ## Quick start @@ -12,28 +12,9 @@ mainNavExclude: true 2. In your project, init SST. - -
-```bash frame="none" -npx sst@latest init +```package-exec +sst@latest init ``` -
-
-```bash frame="none" -yarn dlx sst@latest init -``` -
-
-```bash frame="none" -pnpm dlx sst@latest init -``` -
-
-```bash frame="none" -bunx sst@latest init -``` -
-
3. This will detect your SolidStart app and ask you to update your `app.config.ts`. @@ -45,28 +26,9 @@ server: { 4. When you are ready, you can deploy your app using: - -
-```bash frame="none" -npx sst@latest deploy --stage production -``` -
-
-```bash frame="none" -yarn dlx sst@latest deploy --stage production -``` -
-
-```bash frame="none" -pnpm dlx sst@latest deploy --stage production -``` -
-
-```bash frame="none" -bunx sst@latest deploy --stage production +```package-exec +sst@latest deploy --stage production ``` -
-
You can [read the full tutorial on the SST docs](https://sst.dev/docs/start/aws/solid). diff --git a/src/routes/guides/deployment-options/cloudflare.mdx b/src/routes/guides/deployment-options/cloudflare.mdx index 6a15b6995d..ef2c525981 100644 --- a/src/routes/guides/deployment-options/cloudflare.mdx +++ b/src/routes/guides/deployment-options/cloudflare.mdx @@ -56,31 +56,9 @@ Here are the steps to deploy your Solid project using Wrangler. 1. Use your package manager of choice to install the Wrangler command-line tool: - -
-```bash frame="none" -npm i -g wrangler -``` -
- -
-```bash frame="none" -yarn global add wrangler -``` -
- -
-```bash frame="none" -pnpm add -g wrangler +```package-install-global +wrangler ``` -
- -
-```bash frame="none" -bun add -g wrangler -``` -
-
2. Open your terminal and run the following command to log in: @@ -88,37 +66,17 @@ bun add -g wrangler wrangler login ``` -3. Execute the following commands to build your project and deploy it using Wrangler: +3. Build your project using the following command: - -
-```bash frame="none" -npm run build -wrangler pages publish dist +```package-run +build ``` -
-
-```bash frame="none" -yarn build -wrangler pages publish dist -``` -
+4. Deploy using Wrangler: -
-```bash frame="none" -pnpm build -wrangler pages publish dist -``` -
- -
-```bash frame="none" -bun build +```bash wrangler pages publish dist ``` -
-
After running these commands, your project should be live. While the terminal may provide a link, it's more reliable to check your Cloudflare Pages dashboard for the deployed URL, which usually follows the format `project-name.pages.dev`. diff --git a/src/routes/guides/deployment-options/firebase.mdx b/src/routes/guides/deployment-options/firebase.mdx index 47ea719a2d..4908e29b72 100644 --- a/src/routes/guides/deployment-options/firebase.mdx +++ b/src/routes/guides/deployment-options/firebase.mdx @@ -14,31 +14,9 @@ If you haven't, you can follow [Firebase's official guide](https://firebase.goog 1. Use your preferred package manager to install the Firebase command-line tool with one of the following commands: - -
-```bash frame="none" -npm i -g firebase-tools -``` -
- -
-``` bash frame="none" -yarn global add firebase-tools -``` -
- -
-```bash frame="none" -pnpm add -g firebase-tools -``` -
- -
-```bash frame="none" -bun add -g firebase-tools +```package-install-global +firebase-tools ``` -
-
2. Execute the `firebase login` command to ensure that you're logged into the Firebase account associated with your project. diff --git a/src/routes/guides/deployment-options/netlify.mdx b/src/routes/guides/deployment-options/netlify.mdx index 513572516e..bff4a337bf 100644 --- a/src/routes/guides/deployment-options/netlify.mdx +++ b/src/routes/guides/deployment-options/netlify.mdx @@ -38,31 +38,9 @@ For detailed guidance on build procedures, deployment options, and the range of 1. Install the Netlify CLI using your preferred package manager: - -
-```bash frame="none" -npm i -g netlify-cli +```package-install-global +netlify-cli ``` -
- -
-```bash frame="none" -yarn global add netlify-cli -``` -
- -
-```bash frame="none" -pnpm add -g netlify-cli -``` -
- -
-```bash frame="none" -bun add -g netlify-cli -``` -
-
**Note:** Before proceeding, ensure that your Netlify account and team are fully set up. diff --git a/src/routes/guides/deployment-options/railway.mdx b/src/routes/guides/deployment-options/railway.mdx index 0736678944..fdc29fd7f6 100644 --- a/src/routes/guides/deployment-options/railway.mdx +++ b/src/routes/guides/deployment-options/railway.mdx @@ -69,31 +69,9 @@ Once a domain has been generated, your Solid project should be live. 1. Using your preferred package manager and install the Railway CLI: - -
-```bash frame="none" -npm i -g @railway/cli -``` -
- -
-```bash frame="none" -yarn global add @railway/cli -``` -
- -
-```bash frame="none" -pnpm add -g @railway/cli -``` -
- -
-```bash frame="none" -bun add -g @railway/cli +```package-install-global +@railway/cli ``` -
-
2. Open your terminal and run the following command to log in: diff --git a/src/routes/guides/deployment-options/vercel.mdx b/src/routes/guides/deployment-options/vercel.mdx index 89704fe7a4..7a68e272ce 100644 --- a/src/routes/guides/deployment-options/vercel.mdx +++ b/src/routes/guides/deployment-options/vercel.mdx @@ -49,31 +49,9 @@ For detailed information regarding build and deployment instructions, as well as 1. Install the Vercel CLI using your preferred package manager. - -
-```bash frame="none" -npm i -g vercel -``` -
- -
-```bash frame="none" -yarn global add vercel -``` -
- -
-```bash frame="none" -pnpm add -g vercel -``` -
- -
-```bash frame="none" -bun add -g vercel +```package-install-global +vercel ``` -
-
2. Open your terminal, navigate to your project directory, and run the following command to log in: diff --git a/src/routes/guides/deployment-options/zerops.mdx b/src/routes/guides/deployment-options/zerops.mdx index 412d06c277..bdad800a57 100644 --- a/src/routes/guides/deployment-options/zerops.mdx +++ b/src/routes/guides/deployment-options/zerops.mdx @@ -137,23 +137,10 @@ irm https://zerops.io/zcli/install.ps1 | iex ``` Npm - -
-```bash frame="none" -npm i -g @zerops/zcli -``` -
-
-```bash frame="none" -pnpm add -g @zerops/zcli -``` -
-
-```bash frame="none" -yarn global add @zerops/zcli + +```package-install-global +@zerops/zcli ``` -
-
2. Open Settings > [Access Token Management](https://app.zerops.io/settings/token-management) in the Zerops app and generate a new access token. 3. Log in using your access token with the following command: diff --git a/src/routes/guides/routing-and-navigation.mdx b/src/routes/guides/routing-and-navigation.mdx index bdd13f4681..0e3523643b 100644 --- a/src/routes/guides/routing-and-navigation.mdx +++ b/src/routes/guides/routing-and-navigation.mdx @@ -11,31 +11,9 @@ order: 4 This package is not included by default. - -
-```bash frame="none" -npm install @solidjs/router +```package-install +@solidjs/router ``` -
- -
-```bash frame="none" -yarn add @solidjs/router -``` -
- -
-```bash frame="none" -pnpm add @solidjs/router -``` -
- -
-```bash frame="none" -bun add @solidjs/router -``` -
-
**2. Setup the `` component** diff --git a/src/routes/guides/state-management.mdx b/src/routes/guides/state-management.mdx index 5f5113fbc0..d7ff2830ea 100644 --- a/src/routes/guides/state-management.mdx +++ b/src/routes/guides/state-management.mdx @@ -141,15 +141,13 @@ This keeps the `doubleCount` state in sync with the `count` state, and allows th View this example of [`doubleCount` in a `createEffect` in the Solid Playground example](https://playground.solidjs.com/anonymous/b05dddaa-e62a-4c56-b745-5704f3a40194). - -
- ```html title="Counter.tsx" Current count: 0 Doubled count: 0 ``` -
- -
- ```html title="Counter.tsx" Current count: 1 Doubled count: 2 ``` -
-
+```html tab title="First render" +Current count: 0 Doubled count: 0 +``` + +```html tab title="After increment" +Current count: 1 Doubled count: 2 +``` ## Derived state diff --git a/src/routes/guides/styling-components/less.mdx b/src/routes/guides/styling-components/less.mdx index ba92f217c4..7509fe9169 100644 --- a/src/routes/guides/styling-components/less.mdx +++ b/src/routes/guides/styling-components/less.mdx @@ -11,31 +11,9 @@ It provides the ability to use mixins, variables, and other programmatic tools, To utilize LESS in a Solid app, it will need to be installed as a development dependency: - -
-```bash frame="none" -npm i --save-dev less +```package-install-dev +less ``` -
- -
-```bash frame="none" -yarn add --dev less -``` -
- -
-```bash frame="none" -pnpm add --dev less -``` -
- -
-```bash frame="none" -bun add --dev less -``` -
-
## Using LESS in your app diff --git a/src/routes/guides/styling-components/macaron.mdx b/src/routes/guides/styling-components/macaron.mdx index 029fd66f9d..16ac4ad9ce 100644 --- a/src/routes/guides/styling-components/macaron.mdx +++ b/src/routes/guides/styling-components/macaron.mdx @@ -10,32 +10,9 @@ mainNavExclude: true 1. Install and set up the macaron plugin for your bundler: - -
-```bash frame="none" -npm install @macaron-css/core @macaron-css/solid +```package-install +@macaron-css/core @macaron-css/solid ``` -
- -
-```bash frame="none" -yarn add @macaron-css/core @macaron-css/solid -``` -
- -
-```bash frame="none" -pnpm add @macaron-css/core @macaron-css/solid -``` -
- -
-```bash frame="none" -bun add @macaron-css/core @macaron-css/solid -``` -
-
- 2. Within your `vite.config.js` folder, add the macaron plugin prior to other plugins: diff --git a/src/routes/guides/styling-components/sass.mdx b/src/routes/guides/styling-components/sass.mdx index cbf5326780..becc12cd2f 100644 --- a/src/routes/guides/styling-components/sass.mdx +++ b/src/routes/guides/styling-components/sass.mdx @@ -11,31 +11,9 @@ It is a superset of CSS and offers two syntaxes: SCSS and the indented syntax (o Depending on your package manager, SASS can be installed as a development dependency: - -
-```bash frame="none" -npm i --save-dev sass +```package-install-dev +sass ``` -
- -
-```bash frame="none" -yarn add --dev sass -``` -
- -
-```bash frame="none" -pnpm add --save-dev sass -``` -
- -
-```bash frame="none" -bun add --dev sass -``` -
-
## Convert filename extensions diff --git a/src/routes/guides/styling-components/tailwind-v3.mdx b/src/routes/guides/styling-components/tailwind-v3.mdx index cd820ad7ee..3ae214d9a4 100644 --- a/src/routes/guides/styling-components/tailwind-v3.mdx +++ b/src/routes/guides/styling-components/tailwind-v3.mdx @@ -10,59 +10,16 @@ mainNavExclude: true 1. Install Tailwind CSS as a development dependency: - -
-```bash frame="none" -npm i --save-dev tailwindcss@3 postcss autoprefixer -``` -
- -
-```bash frame="none" -yarn add --dev tailwindcss@3 postcss autoprefixer -``` -
-
-```bash frame="none" -pnpm add --save-dev tailwindcss@3 postcss autoprefixer +```package-install-dev +tailwindcss@3 postcss autoprefixer ``` -
- -
-```bash frame="none" -bun add --save-dev tailwindcss@3 postcss autoprefixer -``` -
-
2. Next, run the init command to generate both `tailwind.config.js` and `postcss.config.js`. - -
-```bash frame="none" -npx tailwindcss init -p -``` -
- -
-```bash frame="none" -yarn dlx tailwindcss init -p -``` -
- -
-```bash frame="none" -pnpm dlx tailwindcss init -p -``` -
- -
-```bash frame="none" -bunx tailwindcss init -p +```package-exec +tailwindcss init -p ``` -
-
3. Since Tailwind CSS is configuration-driven, after initializing, a `tailwind.config.js` file will be created at the root of your project directory: diff --git a/src/routes/guides/styling-components/tailwind.mdx b/src/routes/guides/styling-components/tailwind.mdx index 7c3f4333d5..0f747d7a16 100644 --- a/src/routes/guides/styling-components/tailwind.mdx +++ b/src/routes/guides/styling-components/tailwind.mdx @@ -8,43 +8,16 @@ mainNavExclude: true This guide is for Tailwind CSS v4. For **Tailwind CSS v3** refer to [Tailwind CSS v3](/guides/styling-components/tailwind-v3). ::: -[Tailwind CSS](https://tailwindcss.com/) is an on-demand utility CSS library that integrates seamlessly with Solid as a built-in PostCSS plugin. +[Tailwind CSS](https://tailwindcss.com/) is an on-demand utility CSS library that integrates seamlessly with Solid as a built-in PostCSS plugin. ## Installation 1. Install Tailwind CSS as a development dependency: - -
- -```bash frame="none" -npm i --save-dev tailwindcss @tailwindcss/postcss postcss -``` - -
-
- -```bash frame="none" -yarn add --dev tailwindcss @tailwindcss/postcss postcss +```package-install-dev +tailwindcss @tailwindcss/postcss postcss ``` -
-
- -```bash frame="none" -pnpm add --save-dev tailwindcss @tailwindcss/postcss postcss -``` - -
-
- -```bash frame="none" -bun add --save-dev tailwindcss @tailwindcss/postcss postcss -``` - -
-
- 2. Add `@tailwind/postcss` to the `plugins` in your PostCSS configuration. If you do not have a PostCSS configuration file, create a new one called `postcss.config.mjs`. ```js title="postcss.config.mjs" diff --git a/src/routes/guides/styling-components/uno.mdx b/src/routes/guides/styling-components/uno.mdx index 37b4a99b37..e79499cc37 100644 --- a/src/routes/guides/styling-components/uno.mdx +++ b/src/routes/guides/styling-components/uno.mdx @@ -9,31 +9,10 @@ mainNavExclude: true ## Install Vite plugin To get started with UnoCSS in your Solid app: - -
-```bash frame="none" -npm i --save-dev unocss -``` -
- -
-```bash frame="none" -yarn add --dev unocss -``` -
- -
-```bash frame="none" -pnpm add --save-dev unocss -``` -
-
-```bash frame="none" -bun add --save-dev unocss +```package-install-dev +unocss ``` -
-
## Import Vite plugin diff --git a/src/routes/guides/testing.mdx b/src/routes/guides/testing.mdx index d0a1001c6e..4403909760 100644 --- a/src/routes/guides/testing.mdx +++ b/src/routes/guides/testing.mdx @@ -18,27 +18,13 @@ Testing your Solid applications is important to inspiring confidence in your cod ### Adding testing packages -The recommended testing framework for Solid applications is [vitest](https://vitest.dev). +The recommended testing framework for Solid applications is [vitest](https://vitest.dev). To get started with vitest, install the following development dependencies: - -
-```bash frame="none" -npm i -D vitest jsdom @solidjs/testing-library @testing-library/user-event @testing-library/jest-dom +```package-install-dev +vitest jsdom @solidjs/testing-library @testing-library/user-event @testing-library/jest-dom ``` -
-
-```bash frame="none" -yarn add -D vitest jsdom @solidjs/testing-library @testing-library/user-event @testing-library/jest-dom -``` -
-
-```bash frame="none" -pnpm i -D vitest jsdom @solidjs/testing-library @testing-library/user-event @testing-library/jest-dom -``` -
-
### Testing configuration @@ -94,9 +80,7 @@ Testing components involves three main things: To write tests for your components, create a `[name].test.tsx` file. The purpose of this file is to describe the intended behavior from a user's perspective in the form of unit tests: - -
-```jsx frame="none" +```jsx tab title="Counter.test.jsx" import { test, expect } from "vitest" import { render } from "@solidjs/testing-library" import userEvent from "@testing-library/user-event" @@ -112,9 +96,8 @@ test("increments value", async () => { expect(counter).toHaveTextContent("2") }) ``` -
-
-```jsx frame="none" + +```jsx tab title="Counter.jsx" export const Counter = () => { const [count, setCount] = createSignal(1); return ( @@ -124,8 +107,6 @@ export const Counter = () => { ); } ``` -
-
In the `test.jsx` file, [the `render` call from `@solidjs/testing-library`](https://testing-library.com/docs/solid-testing-library/api#render) is used to render the component and supply the props and context. To mimic a user interaction, `@testing-library/user-event` is used. @@ -133,23 +114,9 @@ The [`expect` function provided by `vitest`](https://vitest.dev/api/expect.html) To run this test, use the following command: - -
-```bash frame="none" -npm test +```package-run +test ``` -
-
-```bash frame="none" -yarn test -``` -
-
-```bash frame="none" -pnpm test -``` -
-
If running the command is successful, you will get the following result showing whether the tests have passed or failed: @@ -243,9 +210,7 @@ For more information, check the [testing-library documentation](https://testing- Solid allows components to break through the DOM tree structure using [``](/reference/components/portal). This mechanism will still work in testing, so the content of the portals will break out of the testing container. In order to test this content, make sure to use the `screen` export to query the contents: - -
-```jsx frame="none" +```jsx tab title="Toast.test.jsx" import { test, expect } from "vitest" import { render, screen } from "@solidjs/testing-library" import { Toast } from "./Toast" @@ -256,9 +221,8 @@ test("increments value", async () => { expect(toast).toHaveTextContent("This is a toast") }) ``` -
-
-```jsx frame="none" + +```jsx tab title="Toast.jsx" import { Portal } from "solid-js/web"; export const Toast = (props) => { @@ -271,8 +235,6 @@ export const Toast = (props) => { ); } ``` -
-
#### Testing in context @@ -402,9 +364,7 @@ This, along with the ability to modify the `arg` signal, are helpful when testin If, for example, you have a directive that handles the [Fullscreen API](https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API), you can test it like this: - -
-```ts frame="none" +```ts tab title="fullscreen.test.ts" import { test, expect, vi } from "vitest" import { renderDirective } from "@solidjs/testing-library" import { createFullScreen } from "./fullscreen" @@ -417,9 +377,8 @@ test("toggles fullscreen", () => { expect(fs).toHaveBeenCalled() }) ``` -
-
-```ts frame="none" + +```ts tab title="fullscreen.ts" import { Accessor } from "solid-js" export const fullscreen = (ref: HTMLElement, active: Accessor) => @@ -432,8 +391,6 @@ export const fullscreen = (ref: HTMLElement, active: Accessor) => } }) ``` -
-
### Primitive testing @@ -562,23 +519,9 @@ The numbers should always be taken with a grain of salt, but can still indicate While coverage numbers can be misleading, they are used by many projects as a rough measurement of code quality. Vitest supports coverage collection. To use it, it needs an extra package: - -
-```bash frame="none" -npm i -D @vitest/coverage-v8 -``` -
-
-```bash frame="none" -yarn add -D @vitest/coverage-v8 -``` -
-
-```bash frame="none" -pnpm i -D @vitest/coverage-v8 +```package-install-dev +@vitest/coverage-v8 ``` -
-
Also, you need to [set up vitest's coverage feature](https://vitest.dev/guide/coverage.html). diff --git a/src/routes/pt-br/quick-start.mdx b/src/routes/pt-br/quick-start.mdx index 76a48582aa..b3164b1b3a 100644 --- a/src/routes/pt-br/quick-start.mdx +++ b/src/routes/pt-br/quick-start.mdx @@ -36,21 +36,8 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
```bash frame="none" yarn install ```
- -
-```bash frame="none" -pnpm install +```package-install-local ``` -
-
4. Run the application: @@ -77,21 +64,8 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
```bash frame="none" yarn install ```
- -
-```bash frame="none" -pnpm install +```package-install-local ``` -
-
4. Run the application: diff --git a/src/routes/pt-br/solid-router/quick-start.mdx b/src/routes/pt-br/solid-router/quick-start.mdx index 76a48582aa..b3164b1b3a 100644 --- a/src/routes/pt-br/solid-router/quick-start.mdx +++ b/src/routes/pt-br/solid-router/quick-start.mdx @@ -36,21 +36,8 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
```bash frame="none" yarn install ```
- -
-```bash frame="none" -pnpm install +```package-install-local ``` -
-
4. Run the application: @@ -77,21 +64,8 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
```bash frame="none" yarn install ```
- -
-```bash frame="none" -pnpm install +```package-install-local ``` -
-
4. Run the application: diff --git a/src/routes/quick-start.mdx b/src/routes/quick-start.mdx index f9df35feb3..b73b61f12b 100644 --- a/src/routes/quick-start.mdx +++ b/src/routes/quick-start.mdx @@ -24,38 +24,9 @@ To get an application running, follow the steps below based on the language you 1. Run the following command in your terminal to get the JavaScript starter template: - -
-```bash frame="none" -npx degit solidjs/templates/js my-app -``` -
- -
-```bash frame="none" -yarn dlx degit solidjs/templates/js my-app -``` -
- -
-```bash frame="none" -pnpm dlx degit solidjs/templates/js my-app -``` -
- -
-```bash frame="none" -bunx degit solidjs/templates/js my-app +```package-exec +degit solidjs/templates/js my-app ``` -
- -
-```bash frame="none" -deno -A npm:degit solidjs/templates/js my-app -``` -
-
- 2. Navigate to your application's directory: @@ -65,70 +36,13 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
-```bash frame="none" -yarn install +```package-install-local ``` -
- -
-```bash frame="none" -pnpm install -``` -
- -
-```bash frame="none" -bun install -``` -
- -
-```bash frame="none" -deno install -``` -
-
- 4. Run the application: - -
-```bash frame="none" -npm run dev +```package-run +dev ``` -
- -
-```bash frame="none" -yarn dev -``` -
- -
-```bash frame="none" -pnpm dev -``` -
- -
-```bash frame="none" -bun dev -``` -
-
-```bash frame="none" -deno task dev -``` -
-
This will start the development server. Now, you can open your browser and navigate to `localhost:3000` to see your application running. @@ -137,36 +51,9 @@ Now, you can open your browser and navigate to `localhost:3000` to see your appl 1. To use a TypeScript template, run the following command in your terminal: - -
-```bash frame="none" -npx degit solidjs/templates/ts my-app -``` -
- -
-```bash frame="none" -yarn dlx degit solidjs/templates/ts my-app -``` -
- -
-```bash frame="none" -pnpm dlx degit solidjs/templates/ts my-app +```package-exec +degit solidjs/templates/ts my-app ``` -
- -
-```bash frame="none" -bunx degit solidjs/templates/ts my-app -``` -
-
-```bash frame="none" -deno -A npm:degit solidjs/templates/ts my-app -``` -
-
2. Navigate to your application's directory: @@ -176,70 +63,14 @@ cd my-app 3. Install the necessary dependencies: - -
-```bash frame="none" -npm install -``` -
- -
-```bash frame="none" -yarn install -``` -
- -
-```bash frame="none" -pnpm install -``` -
- -
-```bash frame="none" -bun install -``` -
-
-```bash frame="none" -deno install +```package-install-local ``` -
-
4. Run the application: - -
-```bash frame="none" -npm run dev -``` -
- -
-```bash frame="none" -yarn dev +```package-run +dev ``` -
- -
-```bash frame="none" -pnpm dev -``` -
- -
-```bash frame="none" -bun dev -``` -
-
-```bash frame="none" -deno task dev -``` -
-
- This will start the development server. Now, you can open your browser and navigate to `localhost:3000` to see your application running. diff --git a/src/routes/reference/reactive-utilities/untrack.mdx b/src/routes/reference/reactive-utilities/untrack.mdx index b73d87b8d8..5a75ba28cc 100644 --- a/src/routes/reference/reactive-utilities/untrack.mdx +++ b/src/routes/reference/reactive-utilities/untrack.mdx @@ -19,10 +19,9 @@ export function Component(props) { It is not necessary to manually untrack values that are suppose to serve as a default or initial value to a signal. Even with the linter configured to enforce tracking, the linter will accept it when a `prop` is prefixed with `default` or `initial` as it is a common pattern to use them as such. - -
-```tsx title="component.tsx" {4} +```tsx tab title="initialValue" {4} +// component.tsx import { createSignal } from "solid-js" export function Component(props) { @@ -32,11 +31,9 @@ export function Component(props) { } } ``` -
-
- -```tsx title="component.tsx" {4} +```tsx tab title="defaultValue" {4} +// component.tsx import { createSignal } from "solid-js" export function Component(props) { @@ -46,5 +43,3 @@ export function Component(props) { } } ``` -
-
\ No newline at end of file diff --git a/src/routes/solid-meta/getting-started/installation-and-setup.mdx b/src/routes/solid-meta/getting-started/installation-and-setup.mdx index 1e09b57f87..2b2fd7ff0d 100644 --- a/src/routes/solid-meta/getting-started/installation-and-setup.mdx +++ b/src/routes/solid-meta/getting-started/installation-and-setup.mdx @@ -12,31 +12,9 @@ For earlier versions (eg. `v0.x`), you must use `v0.26.x`. To get started, install using your preferred package manager. - -
-```bash frame="none" -npm i @solidjs/meta +```package-install +@solidjs/meta ``` -
- -
-```bash frame="none" -yarn add @solidjs/meta -``` -
- -
-```bash frame="none" -pnpm add @solidjs/meta -``` -
- -
-```bash frame="none" -deno add npm:@solidjs/meta -``` -
-
## Setup @@ -67,4 +45,4 @@ const App = () => ( On the server, tags are collected, and then on the client, server-generated tags are replaced with those rendered on the client side. This process is important for maintaining the expected behavior, such as Single Page Applications (SPAs) when pages load that require changes to the head tags. -However, you can manage asset insertion using `getAssets` from `solid-js/web`. +However, you can manage asset insertion using `getAssets` from `solid-js/web`. diff --git a/src/routes/solid-router/getting-started/installation-and-setup.mdx b/src/routes/solid-router/getting-started/installation-and-setup.mdx index c6918d0f17..15ec2e8e9f 100644 --- a/src/routes/solid-router/getting-started/installation-and-setup.mdx +++ b/src/routes/solid-router/getting-started/installation-and-setup.mdx @@ -13,37 +13,9 @@ To use Solid Router, components called Routes that depend on the value of the UR To get started with Solid Router, install it using your preferred package manager. - -
-```bash frame="none" -npm i @solidjs/router +```package-install +@solidjs/router ``` -
- -
-```bash frame="none" -yarn add @solidjs/router -``` -
- -
-```bash frame="none" -pnpm add @solidjs/router -``` -
- -
-```bash frame="none" -bun add @solidjs/router -``` -
- -
-```bash frame="none" -deno add npm:@solidjs/router -``` -
-
## Configure the routes diff --git a/src/routes/solid-router/reference/data-apis/use-submission.mdx b/src/routes/solid-router/reference/data-apis/use-submission.mdx index 777dff79af..f85ceece84 100644 --- a/src/routes/solid-router/reference/data-apis/use-submission.mdx +++ b/src/routes/solid-router/reference/data-apis/use-submission.mdx @@ -61,10 +61,8 @@ When the form is submitted, the `submission` object will be updated with the new This allows you to provide feedback to the user that the action is in progress. Once the action is complete, the `pending` property will be set to `false` and the `result` property will be updated with final value. - - -
-```tsx title="component.tsx" {5,9-11} +```tsx tab title="TypeScript" {5,9-11} +// component.tsx import { Show } from "solid-js"; import { useSubmission } from "@solidjs/router"; @@ -91,9 +89,9 @@ function Component() { ) } ``` -
-
-```tsx title="component.jsx" {5,9-11} + +```tsx tab title="JavaScript" {5,9-11} +// component.jsx import { Show } from "solid-js"; import { useSubmission } from "@solidjs/router"; @@ -120,8 +118,6 @@ function Component() { ) } ``` -
-
## Error Handling diff --git a/src/routes/solid-router/reference/data-apis/use-submissions.mdx b/src/routes/solid-router/reference/data-apis/use-submissions.mdx index 2dad465b4d..592de69d89 100644 --- a/src/routes/solid-router/reference/data-apis/use-submissions.mdx +++ b/src/routes/solid-router/reference/data-apis/use-submissions.mdx @@ -91,10 +91,8 @@ When the form is submitted, the `submission` object will be updated with the new This allows you to provide feedback to the user that the action is in progress. Once the action is complete, the `pending` property will be set to `false` and the `result` property will be updated with final value. - - -
-```tsx title="component.tsx" {5,12-19} +```tsx tab title="TypeScript" {5,12-19} +// component.tsx import { Show } from "solid-js"; import { useSubmissions } from "@solidjs/router"; @@ -123,9 +121,9 @@ function Component() { ) } ``` -
-
-```tsx title="component.jsx" {5,12-19} + +```tsx tab title="JavaScript" {5,12-19} +// component.jsx import { Show } from "solid-js"; import { useSubmissions } from "@solidjs/router"; @@ -154,8 +152,6 @@ function Component() { ) } ``` -
-
## Error Handling diff --git a/src/routes/solid-start/building-your-application/data-loading.mdx b/src/routes/solid-start/building-your-application/data-loading.mdx index f194e63b5a..607a9c32af 100644 --- a/src/routes/solid-start/building-your-application/data-loading.mdx +++ b/src/routes/solid-start/building-your-application/data-loading.mdx @@ -12,9 +12,8 @@ Solid provides a way to load data from your data sources using the [`createResou It takes an async function and returns a [signal](/reference/basic-reactivity/create-signal) from it. `createResource` integrates with [`Suspense`](/reference/components/suspense) and [`ErrorBoundary`](/reference/components/error-boundary) to help manage lifecycle and error states. - -
-```tsx {6-9} title="/src/routes/users.tsx" +```tsx tab title="TypeScript" {6-9} +// src/routes/users.tsx import { For, createResource } from "solid-js"; type User = { name: string; house: string }; @@ -28,9 +27,9 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    -
    -```tsx {4-7} title="/src/routes/users.jsx" + +```tsx tab title="JavaScript" {4-7} +// src/routes/users.jsx import { For, createResource } from "solid-js"; export default function Page() { @@ -42,8 +41,6 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    -
    When fetching inside components, you can encounter unnecessary waterfalls, especially when nested under lazy loaded sections. To solve this, it is recommended to hoist the data fetching to the top of the component tree or, when in [SolidStart](/solid-start), use the server to fetch data in a non-blocking way. @@ -51,9 +48,8 @@ For the example below we will be using the data in APIs in [`solid-router`](/sol Using some of the features of `solid-router`, we can create a cache for our data: - -
    -```tsx title="/routes/users.tsx" {6, 9, 12} +```tsx tab title="TypeScript" {6, 9, 12} +// /routes/users.tsx import { For } from "solid-js"; import { createAsync, query } from "@solidjs/router"; @@ -74,10 +70,9 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    -
    -```tsx title="/routes/users.jsx" {4, 7, 10} +```tsx tab title="JavaScript" {4, 7, 10} +// /routes/users.jsx import { For } from "solid-js"; import { createAsync, query } from "@solidjs/router"; @@ -96,8 +91,6 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    -
    With this method, however, there are some caveats to be aware of: @@ -119,9 +112,8 @@ Through the `"use server"` comment you can tell the bundler to create an RPC and This lets you write code that only runs on the server without needing to create an API route for it. For example, it could be database access or internal APIs, or when you sit within your function and need to use your server. - -
    -```tsx title="/routes/users.tsx" {7} +```tsx tab title="TypeScript" {7} +// /routes/users.tsx import { For } from "solid-js"; import { createAsync, query } from "@solidjs/router"; @@ -142,11 +134,9 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    - -
    -```tsx title="/routes/users.jsx" {5} +```tsx tab title="JavaScript" {5} +// /routes/users.jsx import { For } from "solid-js"; import { createAsync, query } from "@solidjs/router"; @@ -165,5 +155,3 @@ export default function Page() { return {(user) =>
  • {user.name}
  • }
    ; } ``` -
    -
    diff --git a/src/routes/solid-start/building-your-application/routing.mdx b/src/routes/solid-start/building-your-application/routing.mdx index eba09201df..b7ac8acf99 100644 --- a/src/routes/solid-start/building-your-application/routing.mdx +++ b/src/routes/solid-start/building-your-application/routing.mdx @@ -37,7 +37,7 @@ export default function App() { ``` The `` component expects a `root` prop which functions as the root layout of your entire app. -You will want to make sure `props.children` is wrapped in `` since each component will be lazy-loaded automatically. +You will want to make sure `props.children` is wrapped in `` since each component will be lazy-loaded automatically. Without this, you could see some unexpected hydration errors. `` will generate a route for each file in the `routes` directory and its subdirectories. For a route to be rendered as a page, it must default export a component. @@ -78,35 +78,32 @@ When a file is named `index`, it will be rendered when there are no additional U If you want to create nested layouts you can create a file with the same name as a route folder. ```jsx {2} -|-- routes/ +|-- routes/ |-- blog.tsx // layout file |-- blog/ |-- article-1.tsx // example.com/blog/article-1 |-- article-2.tsx // example.com/blog/article-2 ``` -In this case, the `blog.tsx` file will act as a layout for the articles in the `blog` folder. +In this case, the `blog.tsx` file will act as a layout for the articles in the `blog` folder. You can reference the child's content by using `props.children` in the layout. - -
    -```tsx title="routes/blog.tsx" +```tsx tab title="TypeScript" +// routes/blog.tsx import { RouteSectionProps } from "@solidjs/router"; export default function BlogLayout(props: RouteSectionProps) { return
    {props.children}
    ; } ``` -
    -
    - ```jsx title="routes/blog.jsx" + +```jsx tab title="JavaScript" +// routes/blog.jsx export default function BlogLayout(props) { return
    {props.children}
    ; } ``` -
    -
    **Note**: Creating a `blog/index.tsx` or `blog/(blogIndex).tsx` is not the same as it would only be used for the index route. @@ -250,9 +247,7 @@ In SolidStart, route groups are defined by using parenthesis (`()`) surrounding SolidStart offers a way to add additional route configuration outside of the file system. Since SolidStart supports the use of other routers, you can use the `route` export provided by `` to define the route configuration for the router of your choice. - -
    -```jsx {3-7} +```jsx tab title="TypeScript" {3-7} import type { RouteSectionProps, RouteDefinition } from "@solidjs/router"; export const route = { @@ -270,10 +265,8 @@ export default function UsersLayout(props: RouteSectionProps) { ); } ``` -
    -
    -```jsx {3-7} +```jsx tab title="JavaScript" {3-7} export const route = { preload() { // define preload function @@ -289,8 +282,6 @@ export default function UsersLayout(props) { ); } ``` -
    -
    [api-routes]: /core-concepts/api-routes diff --git a/src/routes/solid-start/getting-started.mdx b/src/routes/solid-start/getting-started.mdx index 38302901ac..500d9c8aac 100644 --- a/src/routes/solid-start/getting-started.mdx +++ b/src/routes/solid-start/getting-started.mdx @@ -3,43 +3,15 @@ title: "Getting started" --- The easiest way to get started with Solid is to use the SolidStart starter. -This starter contains a collection of templates that can be used to quickly bootstrap a new Solid application. +This starter contains a collection of templates that can be used to quickly bootstrap a new Solid application. **1. Install SolidStart** Once you have created a directory for your new application, you can initialize SolidStart with the following command: - -
    -```bash frame="none" -npm init solid@latest +```package-create +solid@latest ``` -
    - -
    -```bash frame="none" -yarn create solid -``` -
    - -
    -```bash frame="none" -pnpm create solid -``` -
    - -
    -```bash frame="none" -bun create solid -``` -
    - -
    -```bash frame="none" -deno run -A npm:create-solid -``` -
    -
    **2. Choose a template** @@ -56,44 +28,15 @@ You can see a [list of these options in the SolidStart repository](https://githu with-vitest ``` -Following the prompts, you might be asked questions like whether you want to use Server Side Rendering or TypeScript. +Following the prompts, you might be asked questions like whether you want to use Server Side Rendering or TypeScript. Choose your desired options to continue. **3. Install dependencies** Once you have chosen your template and configuration options, you can navigate to the directory you created and run the following command to install dependencies: - -
    -```bash frame="none" -npm install -``` -
    - -
    -```bash frame="none" -yarn install -``` -
    - -
    -```bash frame="none" -pnpm i +```package-install-local ``` -
    - -
    -```bash frame="none" -bun install -``` -
    - -
    -```bash frame="none" -deno install -``` -
    -
    After this command has finished, your new SolidStart application is ready to go! @@ -101,37 +44,9 @@ After this command has finished, your new SolidStart application is ready to go! To run your application locally, you can use the following command: - -
    -```bash frame="none" -npm run dev -``` -
    - -
    -```bash frame="none" -yarn dev -``` -
    - -
    -```bash frame="none" -pnpm dev -``` -
    - -
    -```bash frame="none" -bun dev -``` -
    - -
    -```bash frame="none" -deno task dev +```package-run +dev ``` -
    -
    Your application should now be running locally on port 3000. You can view it by navigating to [http://localhost:3000](http://localhost:3000). diff --git a/src/routes/solid-start/guides/data-fetching.mdx b/src/routes/solid-start/guides/data-fetching.mdx index 5bdc6866c3..b0bd1abeb1 100644 --- a/src/routes/solid-start/guides/data-fetching.mdx +++ b/src/routes/solid-start/guides/data-fetching.mdx @@ -14,10 +14,8 @@ For detailed API information, refer to the [Solid](/) and [Solid Router](/solid- Here's a simple example: - -
    - -```tsx title="src/routes/index.tsx" +```tsx tab title="TypeScript" +// src/routes/index.tsx import { For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -36,10 +34,8 @@ export default function Page() { } ``` -
    -
    - -```jsx title="src/routes/index.jsx" +```jsx tab title="JavaScript" +// src/routes/index.jsx import { For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -58,9 +54,6 @@ export default function Page() { } ``` -
    -
    - In this example, a [`query`](/solid-router/reference/data-apis/query) is created. In order to access it's data within the component, the [`createAsync`](/solid-router/reference/data-apis/create-async) primitive was used. @@ -71,10 +64,8 @@ To show a loading UI during data-fetching: 1. Import [`Suspense`](/reference/components/suspense) from `solid-js`. 2. Wrap your data rendering in ``, and use the `fallback` prop to show a component during data fetching. - -
    - -```tsx {13} {15} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {13} {15} +// src/routes/index.tsx import { Suspense, For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -95,10 +86,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {13} {15} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {13} {15} +// src/routes/index.jsx import { Suspense, For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -119,9 +108,6 @@ export default function Page() { } ``` -
    -
    - ## Handling errors To show a fallback UI if the data-fetching fails: @@ -129,10 +115,8 @@ To show a fallback UI if the data-fetching fails: 1. Import [`ErrorBoundary`](/reference/components/error-boundary) from `solid-js`. 2. Wrap the data rendering in ``, and use the `fallback` prop to show a component if an error occurs. - -
    - -```tsx {13} {17} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {13} {17} +// src/routes/index.tsx import { ErrorBoundary, Suspense, For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -155,10 +139,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {13} {17} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {13} {17} +// src/routes/index.jsx import { ErrorBoundary, Suspense, For } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -181,9 +163,6 @@ export default function Page() { } ``` -
    -
    - ## Preloading data Data fetching can be optimized during user navigation by preloading the data: @@ -192,10 +171,8 @@ Data fetching can be optimized during user navigation by preloading the data: 2. Run your query inside the `preload` function. 3. Use the query as usual in your component. - -
    - -```tsx {9-11} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {9-11} +// src/routes/index.tsx import { ErrorBoundary } from "solid-js"; import { query, createAsync, type RouteDefinition } from "@solidjs/router"; @@ -220,10 +197,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {9-11} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {9-11} +// src/routes/index.jsx import { ErrorBoundary } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -248,17 +223,12 @@ export default function Page() { } ``` -
    -
    - ## Passing parameters to queries When creating a query that accepts parameters, define your query function to take any number of arguments: - -
    - -```tsx {4} {10} {15} title="src/routes/posts/[id]/index.tsx" +```tsx tab title="TypeScript" {4} {10} {15} +// src/routes/posts/[id]/index.tsx import { ErrorBoundary } from "solid-js"; import { query, createAsync, type RouteDefinition } from "@solidjs/router"; @@ -284,10 +254,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {4} {10} {15} title="src/routes/posts/[id]/index.jsx" +```jsx tab title="JavaScript" {4} {10} {15} +// src/routes/posts/[id]/index.jsx import { ErrorBoundary } from "solid-js"; import { query, createAsync } from "@solidjs/router"; @@ -313,17 +281,12 @@ export default function Page() { } ``` -
    -
    - ## Using a database or an ORM To safely interact with your database or ORM in a query, ensure it's server-only by adding [`"use server"`](/solid-start/reference/server/use-server) as the first line of your query: - -
    - -```tsx {6-7} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {6-7} +// src/routes/index.tsx import { For, ErrorBoundary } from "solid-js"; import { query, createAsync, type RouteDefinition } from "@solidjs/router"; import { db } from "~/lib/db"; @@ -349,10 +312,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {6-7} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {6-7} +// src/routes/index.jsx import { For, ErrorBoundary } from "solid-js"; import { query, createAsync } from "@solidjs/router"; import { db } from "~/lib/db"; @@ -378,17 +339,12 @@ export default function Page() { } ``` -
    -
    - ## Fetching data on the client To fetch data only on the client, use the [`createResource`](/reference/basic-reactivity/create-resource) primitive: - -
    - -```tsx {4-7} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {4-7} +// src/routes/index.tsx import { createResource, ErrorBoundary, Suspense, For } from "solid-js"; export default function Page() { @@ -408,10 +364,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {4-7} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {4-7} +// src/routes/index.jsx import { createResource, ErrorBoundary, Suspense, For } from "solid-js"; export default function Page() { @@ -431,9 +385,6 @@ export default function Page() { } ``` -
    -
    - See the [`createResource`](/reference/basic-reactivity/create-resource) API reference for more information. :::info[Advanced Data Handling] diff --git a/src/routes/solid-start/guides/data-mutation.mdx b/src/routes/solid-start/guides/data-mutation.mdx index 99e6a3509c..5ece6e3506 100644 --- a/src/routes/solid-start/guides/data-mutation.mdx +++ b/src/routes/solid-start/guides/data-mutation.mdx @@ -14,10 +14,8 @@ To handle [`
    `](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/f 3. Ensure the `` element uses the `post` method for submission. 4. Use the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) object in the action to extract field data using the navite `FormData` methods. - -
    - -```tsx {3-9} {13} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {3-9} {13} +// src/routes/index.tsx import { action } from "@solidjs/router"; const addPost = action(async (formData: FormData) => { @@ -38,10 +36,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {3-9} {13} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {3-9} {13} +// src/routes/index.jsx import { action } from "@solidjs/router"; const addPost = action(async (formData) => { @@ -62,17 +58,12 @@ export default function Page() { } ``` -
    -
    - ## Passing additional arguments To pass additional arguments to your action, use the `with` method: - -
    - -```tsx {14} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {14} +// src/routes/index.tsx import { action } from "@solidjs/router"; const addPost = action(async (userId: number, formData: FormData) => { @@ -94,10 +85,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {14} title="src/routes/index.jsx" +```jsx {14} tab title="JavaScript" +// src/routes/index.jsx import { action } from "@solidjs/router"; const addPost = action(async (userId, formData) => { @@ -119,9 +108,6 @@ export default function Page() { } ``` -
    -
    - ## Showing pending UI To display a pending UI during action execution: @@ -129,10 +115,8 @@ To display a pending UI during action execution: 1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`. 2. Call `useSubmission` with your action, and use the returned `pending` property to display pending UI. - -
    - -```tsx {12} {16-18} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {12} {16-18} +// src/routes/index.tsx import { action, useSubmission } from "@solidjs/router"; const addPost = action(async (formData: FormData) => { @@ -156,10 +140,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {12} {16-18} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {12} {16-18} +// src/routes/index.jsx import { action, useSubmission } from "@solidjs/router"; const addPost = action(async (formData) => { @@ -183,9 +165,6 @@ export default function Page() { } ``` -
    -
    - ## Handling errors To handle errors that occur within an action: @@ -193,10 +172,8 @@ To handle errors that occur within an action: 1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`. 2. Call `useSubmission` with your action, and use the returned `error` property to handle the error. - -
    - -```tsx {13} {16-18} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {13} {16-18} +// src/routes/index.tsx import { Show } from "solid-js"; import { action, useSubmission } from "@solidjs/router"; @@ -222,10 +199,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {13} {16-18} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {13} {16-18} +// src/routes/index.jsx import { Show } from "solid-js"; import { action, useSubmission } from "@solidjs/router"; @@ -251,9 +226,6 @@ export default function Page() { } ``` -
    -
    - ## Validating form fields To validate form fields in an action: @@ -262,10 +234,8 @@ To validate form fields in an action: 2. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`. 3. Call `useSubmission` with your action, and use the returned `result` property to handle the errors. - -
    - -```tsx {6-10} {17} {22-24} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {6-10} {17} {22-24} +// src/routes/index.tsx import { Show } from "solid-js"; import { action, useSubmission } from "@solidjs/router"; @@ -296,10 +266,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {6-10} {17} {22-24} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {6-10} {17} {22-24} +// src/routes/index.jsx import { Show } from "solid-js"; import { action, useSubmission } from "@solidjs/router"; @@ -330,9 +298,6 @@ export default function Page() { } ``` -
    -
    - ## Showing optimistic UI To update the UI before the server responds: @@ -340,10 +305,8 @@ To update the UI before the server responds: 1. Import [`useSubmission`](/solid-router/reference/data-apis/use-submission) from `@solidjs/router`. 2. Call `useSubmission` with your action, and use the returned `pending` and `input` properties to display optimistic UI. - -
    - -```tsx {19} {28-30} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {19} {28-30} +// src/routes/index.tsx import { For, Show } from "solid-js"; import { action, useSubmission, query, createAsync } from "@solidjs/router"; @@ -380,10 +343,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {19} {28-30} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {19} {28-30} +// src/routes/index.jsx import { For, Show } from "solid-js"; import { action, useSubmission, query, createAsync } from "@solidjs/router"; @@ -420,9 +381,6 @@ export default function Page() { } ``` -
    -
    - :::info[Multiple Submissions] If you want to display optimistic UI for multiple concurrent submissions, you can use the [`useSubmissions`](/solid-router/reference/data-apis/use-submissions) primitive. ::: @@ -434,10 +392,8 @@ To redirect users to a different route within an action: 1. Import [`redirect`](/solid-router/reference/response-helpers/redirect) from `@solidjs/router`. 2. Call `redirect` with the route you want to navigate to, and throw its response. - -
    - -```tsx {10} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {10} +// src/routes/index.tsx import { action, redirect } from "@solidjs/router"; const addPost = action(async (formData: FormData) => { @@ -460,10 +416,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {10} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {10} +// src/routes/index.jsx import { action, redirect } from "@solidjs/router"; const addPost = action(async (formData) => { @@ -486,17 +440,12 @@ export default function Page() { } ``` -
    -
    - ## Using a database or an ORM To safely interact with your database or ORM in an action, ensure it's server-only by adding [`"use server"`](/solid-start/reference/server/use-server) as the first line of your action: - -
    - -```tsx {5} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {5} +// src/routes/index.tsx import { action } from "@solidjs/router"; import { db } from "~/lib/db"; @@ -516,10 +465,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {5} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {5} +// src/routes/index.jsx import { action } from "@solidjs/router"; import { db } from "~/lib/db"; @@ -539,9 +486,6 @@ export default function Page() { } ``` -
    -
    - ## Invoking an action programmatically To programmatically invoke an action: @@ -549,10 +493,8 @@ To programmatically invoke an action: 1. Import [`useAction`](/solid-router/reference/data-apis/use-action) from `@solidjs/router`. 2. Call `useAction` with your action, and use the returned function to invoke the action. - -
    - -```tsx {13} {17} title="src/routes/index.tsx" +```tsx tab title="TypeScript" {13} {17} +// src/routes/index.tsx import { createSignal } from "solid-js"; import { action, useAction } from "@solidjs/router"; @@ -575,10 +517,8 @@ export default function Page() { } ``` -
    -
    - -```jsx {13} {17} title="src/routes/index.jsx" +```jsx tab title="JavaScript" {13} {17} +// src/routes/index.jsx import { createSignal } from "solid-js"; import { action, useAction } from "@solidjs/router"; @@ -600,6 +540,3 @@ export default function Page() { ); } ``` - -
    -
    diff --git a/src/routes/solid-start/guides/security.mdx b/src/routes/solid-start/guides/security.mdx index 966fc27e3e..605730afd5 100644 --- a/src/routes/solid-start/guides/security.mdx +++ b/src/routes/solid-start/guides/security.mdx @@ -32,10 +32,7 @@ It must then be registered using the [`onRequest`](/solid-start/advanced/middlew 3. Store the nonce in the [`locals`](/solid-start/advanced/middleware#locals) object. 4. Configure SolidStart to use the nonce in your [`entry-server.tsx`](/solid-start/reference/entrypoints/entry-server) file. - -
    - -```tsx +```tsx tab title="Middleware" import { createMiddleware } from "@solidjs/start/middleware"; import { randomBytes } from "crypto"; @@ -59,10 +56,8 @@ export default createMiddleware({ }); ``` -
    -
    - -```tsx {6} title="src/entry-server.tsx" +```tsx tab title="entry-server.tsx" {6} +// src/entry-server.tsx // @refresh reload import { createHandler, StartServer } from "@solidjs/start/server"; @@ -72,9 +67,6 @@ export default createHandler( ); ``` -
    -
    - ### Without nonce To configure CSP without a nonce, a middleware that sets the CSP header is required, and it should be registered to run during the [`onBeforeResponse`](/solid-start/advanced/middleware#onbeforeresponse) event: diff --git a/src/solidbase-theme/mdx-components.tsx b/src/solidbase-theme/mdx-components.tsx index a47900fb37..6c14d3cafb 100644 --- a/src/solidbase-theme/mdx-components.tsx +++ b/src/solidbase-theme/mdx-components.tsx @@ -1,20 +1,67 @@ -import { type ParentProps, children, splitProps } from "solid-js"; +import { + For, + Match, + type ParentProps, + Switch, + children, + createMemo, + splitProps, +} from "solid-js"; import { isServer } from "solid-js/web"; import { A } from "~/ui/i18n-anchor"; import { clientOnly } from "@solidjs/start"; import { Callout } from "~/ui/callout"; +import { Tabs, TabList, TabPanel, Tab } from "~/ui/tabs"; export { EditPageLink } from "../ui/edit-page-link"; export { PageIssueLink } from "../ui/page-issue-link"; export { Callout } from "~/ui/callout"; -export { TabsCodeBlocks } from "~/ui/tab-code-blocks"; export { QuickLinks } from "~/ui/quick-links"; export { ImageLinks } from "~/ui/image-links"; const EraserLinkImpl = clientOnly(() => import("../ui/eraser-link")); -export const DirectiveContainer = Callout; +type CalloutType = "info" | "tip" | "danger" | "caution"; + +export const DirectiveContainer = ( + props: { + type: "tab-group" | "tab" | CalloutType; + title?: string; + codeGroup?: string; + tabNames?: string; + } & ParentProps +) => { + const _children = children(() => props.children).toArray(); + const tabNames = createMemo(() => props.tabNames?.split("\0") ?? []); + + return ( + + } + > + {_children} + + + + + {(title) => {title}} + + + + {(title, idx) => ( + + {_children[idx()]} + + )} + + + + + ); +}; + export const strong = (props: ParentProps) => ( {props.children} ); diff --git a/src/ui/tab-code-blocks.tsx b/src/ui/tab-code-blocks.tsx deleted file mode 100644 index daa4ab66d4..0000000000 --- a/src/ui/tab-code-blocks.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import { Index, JSX, createSignal, onMount } from "solid-js"; - -// Check if children are elements -const isArrayOfElements = (arr: unknown[]): arr is Element[] => { - return arr.every((item) => item instanceof Element); -}; - -/** - * This is a code blocks component that can be used to divide code blocks into separate tabs. Here's an example of how to use it in JSX and mdx: - * @example - * //jsx - * - *
    - *
    - * 			npm install
    - * 		
    - *
    - * ... - *
    - * - * @example - * //jsx - * - *
    - * \```bash frame="none" - * npm install - * \``` - *
    - *
    - * \```bash frame="none" - * yarn install - * \``` - *
    - * ... - *
    - */ - -type Props = { children: JSX.Element }; - -export const TabsCodeBlocks = (props: Props) => { - const [tabs, setTabs] = createSignal(); - const [activeTab, setActiveTab] = createSignal(0); - - onMount(() => { - const children = props.children; - - // Check if children are an array - if (!Array.isArray(children)) - throw new Error("TabsCodeBlocks children must be an array"); - - if (!isArrayOfElements(children)) - throw new Error("TabsCodeBlocks children must be an array of elements"); - - // Check if all elements have ids - const allElementsHaveIds = children.every((child) => "id" in child); - - if (!allElementsHaveIds) - throw new Error("All TabsCodeBlocks children must have an id"); - - setTabs(children); - }); - - return ( -
    - - - - {(tab, idx) => ( -
    {tab()}
    - )} -
    -
    - ); -}; diff --git a/src/ui/tabs.tsx b/src/ui/tabs.tsx new file mode 100644 index 0000000000..899d0c5148 --- /dev/null +++ b/src/ui/tabs.tsx @@ -0,0 +1,55 @@ +import { type PolymorphicProps } from "@kobalte/core"; +import { + Tabs as KobalteTabs, + type TabsRootProps as KobalteTabsRootProps, + type TabsListProps as KobalteTabsListProps, + type TabsTriggerProps as KobalteTabsTriggerProps, + type TabsContentProps as KobalteTabsContentProps, +} from "@kobalte/core/tabs"; + +export type TabsProps = PolymorphicProps< + "div", + Omit +>; + +export function Tabs(props: TabsProps) { + return ; +} + +export type TabListProps = PolymorphicProps< + "div", + Omit +>; + +export function TabList(props: TabListProps) { + return ( +
    + +
    + ); +} + +export type TabProps = PolymorphicProps< + "button", + Omit +>; + +export function Tab(props: TabProps) { + return ( + + ); +} + +export type TabPanelProps = PolymorphicProps< + "div", + Omit +>; + +export function TabPanel(props: TabPanelProps) { + return ( +