Help and search
Screens for finding answers: a help center and a search results page.
Installation & usage
npx @youj/cli add content-help-centerAlso installs accordion, alert, app-page, badge, button, card, content-swap, counter, field, file-upload, icon-arrow-right, icon-banknote, icon-check-circle, icon-code-xml, icon-credit-card, icon-file-text, icon-mail, icon-messages, icon-phone-call, icon-search, icon-shield-alert, icon-shield-check, icon-x, input, input-group, morph-label, presence-list, radio-group, reveal, select, skeleton, spotlight, textarea, youj-core, youj-presets, youj-ui-core.
The CLI copies the block to blocks/content/help-center.tsx with every component it uses, so it’s yours to edit.
Every prop is optional and falls back to the demo, so it renders as you see it until you pass your own. Give it your data, rewrite or translate its strings through copy, and connect its actions:
'use client'
import Link from 'next/link'
import { HelpCenter, type HelpCenterProps } from '@/blocks/content/help-center'
export function HelpCenterView({ categories, articles, popular, questions }: Pick<HelpCenterProps, 'categories' | 'articles' | 'popular' | 'questions'>) {
return (
<HelpCenter
categories={categories}
articles={articles}
popular={popular}
questions={questions}
copy={{ brandSuffix: 'Help' }}
linkComponent={Link}
onSearch={async (query) => {
// await your API here; the block shows progress until it settles
}}
onSubmit={async (request) => {
// await your API here; the block shows progress until it settles
}}
onUpload={async (file) => {
// await your API here; the block shows progress until it settles
}}
/>
)
}Description
Help customers find answers with live search, topic cards and a contact form.
Help customers find answers with live search, topic cards and a contact form.
A results screen for an app or knowledge base, with a query field and suggestions, filters in a side column or a sheet, result cards and empty and error states.
A results screen for an app or knowledge base, with a query field and suggestions, filters in a side column or a sheet, result cards and empty and error states.
Code
Help Center, the Help center story: the files youj add writes.
blocks/content
Reference
Props15 props, 6 types
Props
| Prop | Type | |
|---|---|---|
theme | ThemeInputA theme to force on the block. Default: none, so it inherits the app's (YoujProvider or a ThemeScope around it). | – |
embedded | booleanA page in your app's frame: the shared page header (AppPage) and the frame's gutter, with no brand bar or hero of its own (the status pill moves to the header's actions). default true | true |
categories | HelpCategory[]The topic cards. default Harbor's six | Harbor's six |
articles | HelpArticle[]What the search looks through by title. default Harbor's thirteen | Harbor's thirteen |
onSearch | (query: string) => HelpArticle[] | Promise<HelpArticle[]>Answers a search yourself (your search API, say); without it, | – |
popular | string[]One-press searches under the field; default four | four |
questions | HelpQuestion[]The popular questions. default Harbor's five | Harbor's five |
channels | HelpChannel[]The ways to reach support. default chat, email and phone | chat, email and phone |
topics | HelpTopic[]The choices under "What's this about?". default Harbor's five | Harbor's five |
onSubmit | (request: HelpRequest) => Promise<string>Sends a support request and resolves with the ticket's id; reject with an Error to say why not. default a short demo wait | a short demo wait |
onUpload | (file: File) => Promise<unknown>Uploads an attachment. default a short demo wait | a short demo wait |
brand | { name: string; logo?: ReactNode; href?: string }The product in the header: | – |
statusHref | string | nullThe status pill's link; default '#status' | '#status' |
linkComponent | ElementTypeRenders article and topic links, e.g. Next.js default 'a' | 'a' |
copy | Partial<HelpCenterCopy>Any of the page's strings, to rewrite or translate. | – |
HelpArticle
| Prop | Type | |
|---|---|---|
idRequired | string | – |
titleRequired | string | – |
categoryRequired | stringA category's id; its title shows as a badge. | – |
minutesRequired | numberReading time. | – |
href | stringThe article's page. default `#<id>` | `#<id>` |
HelpCategory
| Prop | Type | |
|---|---|---|
idRequired | string | – |
titleRequired | string | – |
descriptionRequired | string | – |
countRequired | numberHow many articles it holds; counts up as it scrolls in. | – |
iconRequired | HelpIcon | – |
href | stringThe topic's page. default `#<id>` | `#<id>` |
HelpChannel
| Prop | Type | |
|---|---|---|
idRequired | string | – |
titleRequired | string | – |
descriptionRequired | string | – |
iconRequired | HelpIcon | – |
replyRequired | numberThe typical first reply, in | – |
unitRequired | string | – |
HelpQuestion
| Prop | Type | |
|---|---|---|
qRequired | string | – |
aRequired | string | – |
HelpRequest
| Prop | Type | |
|---|---|---|
channelRequired | string | – |
topicRequired | string | – |
referenceRequired | string | – |
messageRequired | string | – |
HelpTopic
| Prop | Type | |
|---|---|---|
valueRequired | string | – |
labelRequired | string | – |
Strings45 keys for copy
Strings
copy takes any of these keys; the rest keep their defaults. A key whose text holds a value (a count, a name) takes a function.
brandSuffixstatusstatusLinktitledescriptionsearchsearchPlaceholderclearSearchpopularresultsresultCountminutesnoResultsBeforenoResultsLinknoResultsAftertopicsarticlesfaqTitlefaqDescriptioncontactTitlecontactDescriptionchanneltypicalReplysendingdoneTitleticketdoneBodyanotherformtopictopicPlaceholdertopicRequiredreferencereferencePlaceholderreferenceHintmessagemessagePlaceholdermessageTooShortattachmentsattachmentsTitleattachmentsHintreplyByreplyChannelsendsendFailedBuilt from20 components
Accessibilitylandmarks, search, filters
Accessibility
Help center has a main with one h1, a labelled search field and a status region that announces the result count as you type; the contact form announces its outcome in a live region. Search results has a main, a labelled aside of filters (a sheet on phones), labelled active-filter chips and a status region for the result count. Its query field offers suggestions in a popover, the arrow keys move between result links, and the empty and error states use a list and an alert. Links and buttons are real a and button elements with the kit’s focus ring.