Skip to content
Frameworks

SolidJS

A provider, primitives and reactive commands for SolidJS and SolidStart.

import { QikbarProvider } from '@qikbar/qikbar/solid'
import { useNavigate } from '@solidjs/router'

export default function App(props) {
  const navigate = useNavigate()
  return (
    <QikbarProvider config={{ routes, navigate: (href) => navigate(href), launcher: 'touch' }}>
      {props.children}
    </QikbarProvider>
  )
}

The bar belongs to the provider’s owner and is destroyed with it. config is tracked, so signals you read in it are applied live.

Commands from components

import { useCommands } from '@qikbar/qikbar/solid'

function ProjectPage(props) {
  useCommands(() => [
    { title: `Archive ${props.project.name}`, icon: 'trash', run: () => archive(props.project.id) },
  ])
  return <div>…</div>
}

Pass an accessor and the commands re-register when the signals it reads change. useSource and useExtension work the same way.

State and control

import { useQikbar } from '@qikbar/qikbar/solid'

function SearchButton() {
  const { open, state } = useQikbar()
  return <button onClick={() => open()}>{state().open ? 'Searching…' : 'Search'}</button>
}

Without the provider

createQikbar (from @qikbar/qikbar/solid) creates a bar owned by the current reactive scope:

const bar = createQikbar(() => ({ placeholder: placeholder() }))

Inline

import { inlineQikbar } from '@qikbar/qikbar/solid'

<div ref={inlineQikbar({ commands, placeholder: 'Search docs…' })} />

SolidStart

The bar only runs in the browser; the provider does nothing during SSR. For the AI endpoint, use createHandler from @qikbar/qikbar/server in an API route:

import { createHandler, anthropic } from '@qikbar/qikbar/server'
const handler = createHandler({ provider: anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }) })
export const POST = ({ request }) => handler(request)
Edit this page on GitHub