useUiConfig
A custom hook for accessing UI configuration from the UiConfigContext
. Allows optional selection of specific parts of the UI config state using a selector function.
For editing and updating the underlying UI config on the fly.
Import
Usage
import { function useUiConfig<T = UiConfigStore>(selector?: (state: UiConfigStore) => T): TuseUiConfig } from "@account-kit/react";
const { const illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefinedillustrationStyle, const auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefinedauth } = useUiConfig<{
illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefined;
auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefined;
}>(selector?: ((state: UiConfigStore) => {
illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefined;
auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefined;
}) | undefined): {
illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefined;
auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefined;
}useUiConfig(
({ illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefinedillustrationStyle, auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefinedauth }) => ({ illustrationStyle: "outline" | "linear" | "filled" | "flat" | undefinedillustrationStyle, auth: {
addPasskeyOnSignup?: boolean;
header?: React.ReactNode;
hideError?: boolean;
onAuthSuccess?: () => void;
sections: AuthType[][];
hideSignInText?: boolean;
} | undefinedauth }),
);
Parameters
selector
(state: UiConfigStore) => T
- An optional function to select specific parts of the UI config state. ref
Returns
T
- The selected state passed through the selector function or the entire state if no selector is provided