{content.description}
``` + +# Design - Content customization - Update page content + +> Guide for updating authentication page content including multi-language support, text variables, and escape route URL configuration for error handling. + +page content, content customization, text variables, multi-language, auth pages, escape route URL, preview +design, content-customization, multi-language + +For maximum extensibility, page content has been decoupled from the page itself. This lets you update the copy on most screens, which you can do via the **Page content** section of the admin area (see below) or via API (coming soon). ### Update page content If your application is built for [multiple languages](https://docs.kinde.com/design/pages/set-language-for-pages/), select these first in Kinde. 1. In Kinde, go to **Design > Page content**. 2. Select the language you want (only applicable if multiple languages are configured). 3. Select the page you want to edit. The list of content shown corresponds with page elements such as headings, field labels, helper text, error messages, etc. 4. Make the changes to the content. If you want, you can use text variables, explained below. 5. When you’ve finished, select **Save**. The save only applies to the current language and page selected. You need to select **Save** again if you edit in different languages. 6. Check changes by selecting **Preview**. You'll only see an accurate preview if the environment is fully connected, otherwise you may see errors. 7. Repeat from step 2 for each language and page you want to edit. ### Text variables for page content Variables are used to stand in for actual values that you want to appear on pages. They are a way of automating content. For example, if you use the `${email_address}` variable, the user’s email address will be shown. Variables can be used on pages as follows. **Sign in confirm code page** `${email_address}` - shows the full email address of the user `${email_address_obfuscated}` - shows only a part of the user's email **Sign up confirm code page** `${email_address}` ### Include ‘escape route’ URL in auth errors When auth errors appear, you want to give users a way to navigate out of them. To provide an ‘escape route’ URL in these situations: 1. In Kinde, go to **Settings > Applications** and select **View details** on your application. 2. Enter your website URL into the **Application homepage URI** and **Application login URI** fields. 3. Select **Save**. + +# Design - Customize with code - Connect your repo for custom pages + +> Guide for connecting GitHub repositories for custom page design including directory structure setup, code preview options, and status monitoring. + +connect repo, custom pages, GitHub, custom domain, code preview, directory structure, code status +design, customize-with-code, git + +To enable your custom code to override Kinde page design, you need to set up and connect a git repo for the design files. You must also be using a [custom domain](/build/domains/pointing-your-domain/) to run your custom code with Kinde. ## Connect your repo 1. Go to **Design > Custom code**. 2. Select the option to **Connect repo**. This will take you to the **Settings > Git Repo** page where you can manage your repo connection for design and workflows. 3. If you don’t already have a repo set up for workflows, select **Connect GitHub**. 4. Follow the prompts to connect a repo and branch. ## Option to enable code preview If you are on the Kinde Plus or Scale plan, you can enable a code preview before you deploy new code to be live. This is helpful for checking the design before making it public in your production environment. If you have a free or Pro plan, we recommend you preview designs in a non-production environment before syncing in production. ## Set up the Git directory structure Your directory structure should follow the following structure. ```jsx myApp/ ├── kindeSrc/ │ └── environment/ │ └── pages/ │ └── (kinde)/ │ └──| Company | Contact | Country |
|---|---|---|
| Alfreds Futterkiste | Maria Anders | Germany |
{description}
{getKindeWidget()} // our footer won't change so exclude from re-rendering ``` This means that only critical page items are being re-rendered. + +# Design - Customize with code - Pages and the Kinde Management API + +> Guide for integrating Kinde Management API with custom pages including M2M setup, environment variables, and common API calls for B2B applications. + +Kinde Management API, M2M application, API calls, server rendering, environment variables, organization API, bindings +design, customize-with-code, api + +Pages are rendered on the server which means it is possible to make API calls before the page is delivered to the browser. The most common use case for this is calling the Kinde Management API to get additional information for the page. ## Before using the Kinde Mangement API for pages 1. [Create an M2M application](/developer-tools/kinde-api/connect-to-kinde-api/) within Kinde and grant it access to the Kinde Management API with the desired scopes. 2. Setup environment variables in Kinde to provide the client ID and secret. By default the `createKindeAPI` method initially looks up the following environment variables setup in Kinde settings to determine the application to use. - `KINDE_WF_M2M_CLIENT_ID` - `KINDE_WF_M2M_CLIENT_SECRET` - Ensure this is setup with sensitive flag enabled to prevent accidental sharing `createKindeAPI` can also accept an additional parameter which can contain `clientID/clientSecret` or `clientIDKey/clientSecretKey` which can define the environment variables to look up. ## Calling the Kinde Management API for pages The example below calls the `environment` API and adds the logo to the page. **Required bindings** ```js export const pageSettings = { bindings: { "kinde.env": {}, "kinde.fetch": {}, url: {} } }; ``` Example usage calling Organization API: ```jsx export default async Page(event: onPageRequestEvent) { const orgCode = event.request.authUrlParams.orgCode; const kindeAPI = await createKindeAPI(event); const { data: res } = await kindeAPI.get({ endpoint: `organization?code=${orgCode}`, }); const {org} = res; return `{org.name}
`; } ``` ## Common API calls for custom page design - `GET /environment` - includes brand settings for the environment including logos / background images. Required M2M scope: `read:environments` - `GET /organizations?org_code=${request.authUrlParams.orgCode}` brand settings for the requested org including logo. Required M2M scope: `read:organizations` - `GET /business` - business details like the business name. Required M2M scope: `read:businesses` - `GET /applications/${request.authUrlParams.clientId}`. Required M2M scope: `read:applications` + +# Design - Customize with code - Libraries and packages for pages + +> Guide for using npm packages and libraries in Kinde page designs including supported packages, React templates, and development dependencies. + +npm packages, libraries, React, Liquid, dev dependencies, runtime environment +design, customize-with-code, packages + +As part of bringing your own code to page designs, you'll likely need to work with some `npm` libraries in addition to the `@kinde/infrastructure` package. Kinde supports a handful of carefully selected libraries from `npm`. These include: `@kinde/infrastructure` This is Kinde’s package that supplies helpers and methods to give you the best possible authoring experience of Kinde pages and workflows. For server side React templates: `react` and `react-dom/server.browser` For Liquid templates: `liquidjs` Attempting to import unsupported packages into your runtime code will result in your deployment failing. Dev dependencies (e.g packages used for linting, tests and build steps) can be used, as they do not affect the Kinde runtime environment. Any code dependent on these packages should be prebuilt before deploying to Kinde. + +# Design - Customize with code - Preview custom code + +> Guide for previewing custom code designs using preview credentials and auth flow testing for Plus and Scale plan users. + +preview custom code, pages_mode, preview password, Plus plan, Scale plan, auth flow +design, customize-with-code, preview + + Unlike changes you make in the Kinde UI that impact page layouts and content, your custom designs can’t be viewed in a Kinde-generated preview. Instead, you can test designs using your real auth flow, using preview credentials. ## Preview custom code 1. In your application code, pass the additional auth url parameter `pages_mode=preview`. When the auth flow is initiated a password screen will appear which is required to view the preview. 2. Enter your preview password. Go to **Design > Custom code > Preview**. 3. Copy the **Password** and use it in the authentication request. The preview will show the latest code deployment version. + +# Design - Customize with code - Quick start guide + +> Quickly set up and run your first Kinde workflow in minutes. + +quick start, custom UI, GitHub template, React Server Components, custom domain, workflow setup +design, customize-with-code, quick-start + +The quickest way to see an end-to-end example of custom HTML/CSS and JS running on Kinde hosted pages is to follow this guide. ## What you need - A Kinde account with an application set up on a [custom domain](/build/domains/pointing-your-domain/). - A GitHub account to host your code. ## Step 1: Clone a Kinde example template 1. Sign in to your GitHub account and go to [Kinde example Splitscape Custom UI template](https://github.com/kinde-starter-kits/custom-ui-splitscape). 2. Select the green **Use this template button**. 3. Select **Create a new repository**. This will create a new repository in your GitHub account with a copy of the example code. It contains a a fully customizable UI starter template built with React Server Components. ## Step 2: Connect your GitHub repository to Kinde 1. Sign in to your Kinde account and go to **Settings > Git repo**. 2. Select **Connect GitHub** and follow the instructions to connect your GitHub account to Kinde. When you select the repository you just created, Kinde will automatically sync the code for you. ## You're done! Assuming you have an application set up, you can see your custom UI by navigating to your sign in screen. You can now modify the custom UI code to look however you like. ## Next steps - Explore the [Kinde custom UI documentation](/design/customize-with-code/customize-with-css-html/) to learn more about how custom UI works. - Take a look at some other example templates + +# Design - Customize with code - Style with style hooks + +> Comprehensive guide for styling Kinde widgets using style hooks including CSS selectors, theme support, dark mode, and HTML data attributes for custom styling. + +style hooks, CSS styling, data attributes, widget styling, dark mode, theme styles, HTML selectors +design, customize-with-code, styling + +Style hooks are [HTML data attributes](https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Solve_HTML_problems/Use_data_attributes) that can be targeted using the [CSS attribute selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors), allowing you to apply styles directly to the Kinde widget in your custom CSS. They give you full control over styling widget components and layouts. Unlike CSS classes, which are used internally, style hooks are dedicated to external (custom) styling. This separation ensures your custom styles remain stable, even if internal styles change. Style hooks are useful when a setting doesn’t exist for a specific style, such as adding a shadow effect to the **Button** component. For example: ```css [data-kinde-button] { box-shadow: 0 1px 3px rgba(12, 12, 12, 0.09); } ``` ## Define style hooks in your CSS Style hooks allow you to apply styles directly in your custom CSS. For example, add a shadow effect to the **Button** component when hovered: ```css [data-kinde-button]:hover { box-shadow: 0 1px 3px rgba(12, 12, 12, 0.09); } ``` ## Available style hooks Nearly all elements in the widget have a style hook applied, allowing you to style it as needed. The best way to see which hooks are available is by using [DevTools](/design/customize-with-code/inspect-design-devtools/). Here’s an example of a form field with its style hooks: ```html