Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to SolidBase callout syntax #1131

Merged
merged 1 commit into from
Mar 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/routes/concepts/context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ const Provider = (props) => (
);
```

<Callout type="tip" title="Complex Types">
:::tip[Complex Types]
When passing multiple values (as an `array` or `object`), it is recommended to use a [store](/reference/component-apis/create-context#usage).
</Callout>
:::

## Consuming context

Expand Down Expand Up @@ -257,9 +257,9 @@ function Child() {

If no default value is passed to `createContext`, it is possible for `useContext` to return `undefined`.

<Callout type="info" title="More on default values">
:::info[More on default values]
Read more about default values in the [`createContext`](/reference/component-apis/create-context) entry.
</Callout>
:::

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).
Expand Down
6 changes: 2 additions & 4 deletions src/routes/guides/styling-components/tailwind.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ order: 5
mainNavExclude: true
---

<Callout type="info" title="Note">

:::info[Note]
This guide is for Tailwind CSS v4. For **Tailwind CSS v3** refer to [Tailwind CSS v3](/guides/styling-components/tailwind-v3).

</Callout>
:::

[Tailwind CSS](https://tailwindcss.com/) is an on-demand utility CSS library that integrates seamlessly with Solid as a built-in PostCSS plugin.

Expand Down
7 changes: 4 additions & 3 deletions src/routes/reference/component-apis/create-context.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ The default value is used when no Provider is found above in the hierarchy.

To avoid reinstatiating a new context when Hot-Module Replacement (HMR) occurs, it is recommended to use `createContext` in its own module (file).

<Callout type="danger" title="Hot-Module Replacement">
When using HMR, the context is lost when the module is reloaded. Which will cause an error to be thrown as `useContext` will try to access it while it is still reloading.
</Callout>
:::danger[Hot-Module Replacement]
When using HMR, the context is lost when the module is reloaded.
Which will cause an error to be thrown as `useContext` will try to access it while it is still reloading.
:::


For example:
Expand Down
8 changes: 4 additions & 4 deletions src/routes/reference/jsx-attributes/attr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Useful for Web Components where you want to set attributes.
<my-element attr:status={props.status} />
```

<Callout type="info" title="Strong-Typing Custom Attributes">
Type definitions are required when using TypeScript.
See the[TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
</Callout>
:::info[Strong-Typing Custom Attributes]
Type definitions are required when using TypeScript.
See the[TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
:::
8 changes: 4 additions & 4 deletions src/routes/reference/jsx-attributes/bool.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This attribute is most useful for Web Components.

```

<Callout type="info" title="Strong-Typing Custom Boolean Attributes">
Type definitions are required when using TypeScript.
See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
</Callout>
:::info[Strong-Typing Custom Boolean Attributes]
Type definitions are required when using TypeScript.
See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
:::
8 changes: 4 additions & 4 deletions src/routes/reference/jsx-attributes/prop.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Forces the prop to be treated as a property instead of an attribute.
<div prop:scrollTop={props.scrollPos + "px"} />
```

<Callout type="info" title="Strong-Typing Custom Properties">
Type definitions are required when using TypeScript.
See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
</Callout>
:::info[Strong-Typing Custom Properties]
Type definitions are required when using TypeScript.
See the [TypeScript](/configuration/typescript#forcing-properties-and-custom-attributes) page for examples.
:::
4 changes: 2 additions & 2 deletions src/routes/reference/jsx-attributes/use.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare module "solid-js" {
}
```

<Callout type="caution" title="Limitations">
:::caution[Limitations]
Directives only work with native HTML elements (HTML/SVG/MathML/Custom Elements).
Directives are not forwarded and **won't work in user defined components**, such as `<MyComponent use:myinput={[..]}/>` [see also](https://github.com/solidjs/solid/discussions/722)
</Callout>
:::
6 changes: 2 additions & 4 deletions src/routes/solid-router/concepts/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ In this example, the `echo` action simulates a fetch call with a 1 second delay
The `echo` action will act as a backend, however, it can be substituted for any API provided it can be run on the client.
Typically, route actions are used with some sort of solution like fetch or GraphQL.

<Callout type="tip">

:::tip
In [SolidStart](/solid-start) apps, it's recommended to use the [`"use server"`](/solid-start/reference/server/use-server) directive to leverage server-side caching.

</Callout>
:::

### Using actions

Expand Down
6 changes: 2 additions & 4 deletions src/routes/solid-router/reference/data-apis/action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,9 @@ const deleteTodo = action(async (id: number) => {

```

<Callout type="tip">

:::tip
In [SolidStart](/solid-start) apps, it's recommended to use the [`"use server"`](/solid-start/reference/server/use-server) directive to leverage server-side caching.

</Callout>
:::

## Notes of `<form>` implementation and SSR

Expand Down
7 changes: 3 additions & 4 deletions src/routes/solid-router/reference/data-apis/use-action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ const updateName = useAction(updateNameAction);
const result = updateName("John Wick");
```

<Callout type="info" title="Note">
`useAction` requires client-side JavaScript and is not progressively
enhanceable.
</Callout>
:::info[Note]
`useAction` requires client-side JavaScript and is not progressively enhanceable.
:::

## Parameters

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ function Component() {
}
```

<Callout type="info">

:::info
Learn more about actions in the [`action`](/solid-router/reference/data-apis/action) docs.

</Callout>
:::

## Filtering Submissions

Expand Down
11 changes: 4 additions & 7 deletions src/routes/solid-router/reference/data-apis/use-submissions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ title: useSubmissions
This helper is used to handle form submissions and can provide optimistic updates while actions are in flight as well as pending state feedback.
This method will return an iterable of all submitted actions while its component is mounted. With an optional second parameter for a filter function.

<Callout type="tip">
:::tip
If you only care for the latest submission, you can use the [`useSubmission`](/solid-router/reference/data-apis/use-submission) helper.
</Callout>
:::

It's important to note that it requires the form method to be **post** otherwise it will trigger a browser navigation and will not work.

Expand Down Expand Up @@ -42,12 +42,9 @@ function Component() {
}
```

<Callout type="info">

:::info
To trigger a submission, [actions](https://docs.solidjs.com/) can be used.


</Callout>
:::

## Filtering Submissions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ Other useful redirect codes:
| `307` | Temporary Redirect |
| `308` | Permanent redirect |

<Callout type="tip" name="Redirect Methods">
307 and 308 won't allow the browser to change the method of the request. If you want to change the method, you should use 301 or 302.
</Callout>
:::tip[Redirect Methods]
307 and 308 won't allow the browser to change the method of the request.
If you want to change the method, you should use 301 or 302.
:::

A common use-case for throwing a redirect is when a user is not authenticated and needs to be sent to the login page or another public route.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ title: revalidate

Revalidate will receive the either a cache key or an array of cache keys and invalidate those queries.

<Callout type="tip" name="Firing Queries Again">
:::tip[Firing Queries Again]
If you intend to re-fire the queries immediately, check the [reload](/solid-router/reference/response-helpers/reload) helper.
</Callout>
:::

The code below will revalidate the `getTodo` query with the cache key.

Expand Down
12 changes: 4 additions & 8 deletions src/routes/solid-start/guides/data-fetching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ Since SolidStart itself provides minimal data-fetching APIs, most functionality

This guide provides practical examples of common data-fetching tasks using these primitives.

<Callout type="info" title="Note">

:::info[Note]
For detailed API information, refer to the [Solid](/) and [Solid Router](/solid-router) documentation.

</Callout>
:::

Here's a simple example:

Expand Down Expand Up @@ -438,8 +436,6 @@ export default function Page() {

See the [`createResource`](/reference/basic-reactivity/create-resource) API reference for more information.

<Callout type="info" title="Advanced Data Handling">

:::info[Advanced Data Handling]
For advanced features like automatic background re-fetching or infinite queries, you can use [Tanstack Query](https://tanstack.com/query/latest/docs/framework/solid/overview).

</Callout>
:::
6 changes: 2 additions & 4 deletions src/routes/solid-start/guides/data-mutation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,9 @@ export default function Page() {
</div>
</TabsCodeBlocks>
<Callout type="info" title="Multiple Submissions">
:::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.
</Callout>
:::
## Redirecting
Expand Down
6 changes: 2 additions & 4 deletions src/routes/solid-start/reference/server/create-middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ There are two lifecycle events available: `onRequest` and `onBeforeResponse`.
- The `onRequest` event is triggered at the beginning of the request lifecycle, before the request is handled by the route handler.
- The `onBeforeResponse` event is triggered after a request has been processed by the route handler but before the response is sent to the client.

<Callout type="info" title="Note">

:::info[Note]
SolidStart will only execute the middleware functions if the path to the middleware file is configured within `app.config.ts` using the `middleware` option.
This file must export the configuration using `export default`.

</Callout>
:::

Learn more about middleware in the [Middleware documentation](/solid-start/advanced/middleware).

Expand Down