Profile Edit Widget – React SDK

Install the Profile Edit Widget (user profile editor) as an NPM package for first-class React (and TypeScript) support.

Installation

npm install @legionhandtech/lht-react-widgets

React 17+ is a peer dependency. If your project already has React installed you're good to go.

Quick Start

1import { LegionProfileEdit } from '@legionhandtech/lht-react-widgets'; 2 3function App() { 4 return ( 5 <LegionProfileEdit 6 baseUrl="https://your-legion-domain.com" 7 authToken="your-jwt-token" 8 theme="light" 9 /> 10 ); 11}

You can also import from the dedicated sub-path:

import { LegionProfileEdit } from '@legionhandtech/lht-react-widgets/profile-edit';

Props Reference

Core Props

PropTypeDefaultDescription
baseUrlstringrequiredBase URL of your Legion instance
authTokenstringJWT token for authenticated profile editing (sent via postMessage)
theme"light" | "dark""light"Preset theme
widthstring"600px"Widget width CSS value
heightstring"800px"Widget height CSS value
classNamestringCSS class on the wrapper div
styleReact.CSSPropertiesInline styles on the wrapper div
onLoad(detail) => voidFires when the widget iframe loads
onError(message: string) => voidFires when the widget iframe fails to load

Theming Props

Fine-grained CSS-variable theming. All props are optional strings.

PropCSS VariableDescription
profileEditBackgroundColorprofile-background-colorContainer background
profileEditTextColorprofile-text-colorPrimary text color
profileEditSecondaryTextColorprofile-secondary-text-colorSecondary text
profileEditBorderColorprofile-border-colorBorder color
profileEditBorderRadiusprofile-border-radiusContainer radius
profileEditPaddingprofile-paddingContainer padding
profileEditShadowprofile-shadowContainer shadow
profileEditPrimaryColorprofile-primary-colorPrimary accent
profileEditPrimaryHoverprofile-primary-hoverPrimary hover
profileEditAccentColorprofile-accent-colorAccent color
profileEditCardBgprofile-card-bgCard background
profileEditCardBorderprofile-card-borderCard border
profileEditCardRadiusprofile-card-radiusCard radius
profileEditCardShadowprofile-card-shadowCard shadow
profileEditCardPaddingprofile-card-paddingCard padding
profileEditAvatarSizeprofile-avatar-sizeAvatar size
profileEditAvatarRadiusprofile-avatar-radiusAvatar radius
profileEditAvatarBorderprofile-avatar-borderAvatar border
profileEditAvatarShadowprofile-avatar-shadowAvatar shadow
profileEditButtonBgprofile-button-bgButton background
profileEditButtonHoverBgprofile-button-hover-bgButton hover bg
profileEditButtonColorprofile-button-colorButton text
profileEditButtonRadiusprofile-button-radiusButton radius
profileEditButtonSecondaryBgprofile-button-secondary-bgSecondary button bg
profileEditButtonSecondaryColorprofile-button-secondary-colorSecondary button text
profileEditInputBgprofile-input-bgInput background
profileEditInputBorderprofile-input-borderInput border
profileEditInputFocusBorderprofile-input-focus-borderInput focus border
profileEditInputRadiusprofile-input-radiusInput radius
profileEditInputTextprofile-input-textInput text color
profileEditInputPlaceholderprofile-input-placeholderInput placeholder
profileEditFontFamilyprofile-font-familyFont family
profileEditNameSizeprofile-name-sizeName font size
profileEditNameWeightprofile-name-weightName font weight
profileEditLabelSizeprofile-label-sizeLabel font size
profileEditDividerColorprofile-divider-colorDivider color
profileEditTransitionDurationprofile-transition-durationTransition timing

Imperative Ref

1import { useRef } from 'react'; 2import { LegionProfileEdit } from '@legionhandtech/lht-react-widgets'; 3import type { LegionProfileEditHandle } from '@legionhandtech/lht-react-widgets'; 4 5function App() { 6 const ref = useRef<LegionProfileEditHandle>(null); 7 8 return ( 9 <> 10 <button onClick={() => ref.current?.refresh()}>Reload</button> 11 <LegionProfileEdit ref={ref} baseUrl="https://your-legion-domain.com" /> 12 </> 13 ); 14}

Web Component

import '@legionhandtech/lht-react-widgets/profile-edit-web-component';
1<legion-profile-edit 2 api-url="https://your-legion-domain.com" 3 auth-token="your-jwt-token" 4 theme="light" 5 width="600" 6 height="800"> 7</legion-profile-edit>

Authentication

The Profile Edit widget uses postMessage to securely deliver the JWT auth token to the iframe after it loads. The token is never included in the URL. Pass the authToken prop and the component handles the rest.

Documentation | Legion Hand Technologies