0.15.0 • Published 2 months ago
@gravity-ui/onboarding v0.15.0
@gravity-ui/onboarding ·
Onboarding for users - important part of any service. @gravity-ui/onboarding helps you to create hint based onboarding scenarios. Can use with React, any other frameworks and vanilla JS.
- Small. ~3Kb(minified and gzipped) with zero dependencies
- Well tested. ~90% test coverage
- Small code footprint. Create onboarding scenario config and connect each step to UI with couple lines of code.
- No UI. Use your own components
- Good TypeScript support
// todo-list-onboarding.ts
export const {
useOnboardingStep,
useOnboardingPreset,
useOnboardingHint,
useOnboarding,
controller,
} = createOnboarding({
config: {
presets: {
toDoListFirstUage: {
name: '',
steps: [
createStep({
slug: 'createTodoList',
name: 'create-todo-list',
description: 'Click button to create todo list',
}),
/* other scanario steps */
],
},
},
},
// onboarding state from backend
baseState: () => {
/* ... */
},
getProgressState: () => {
/* ... */
},
// save new onboarding state to backend
onSave: {
state: (state) => {
/* ... */
},
progress: (progress) => {
/* ... */
},
},
});
// App.tsx
const {anchorRef, hint, open, onClose} = useOnboardingHint();
return (
<HintPopup
open={open}
anchor={anchorRef}
title={hint?.step.name}
description={hint?.step.description}
onClose={onClose}
/>
);
// todo-list.tsx
const {pass, ref} = useOnboardingStep('createFirstIssue');
return (
<Button
onClick={() => {
pass();
handleAddTodoList();
}}
ref={ref}
// ...
>
"Add new list"
</Button>
);
Install
npm i @gravity-ui/onboarding
Usage
TBD
0.15.0
2 months ago
0.14.1
2 months ago
0.14.0
2 months ago
0.13.1
3 months ago
0.13.0
3 months ago
0.12.0
7 months ago
0.11.0
7 months ago
0.10.1
7 months ago
0.10.0
7 months ago
0.9.2
7 months ago
0.9.1
7 months ago
0.9.0
7 months ago
0.8.0
8 months ago
0.7.0
8 months ago
0.6.0
9 months ago
0.5.3
9 months ago
0.5.2
9 months ago
0.5.1
9 months ago
0.5.0
9 months ago
0.4.1
9 months ago
0.4.0
9 months ago
0.3.1
9 months ago
0.3.0
10 months ago
0.2.1
10 months ago
0.2.0
10 months ago
0.1.0
10 months ago