// Copyright (c) Meta Platforms, Inc. and affiliates. 'use client'; import {useState} from 'react'; import {Tokenizer} from '@astryxdesign/core/Tokenizer'; import {Stack} from '@astryxdesign/core/Layout'; import {Text} from '@astryxdesign/core/Text'; import type {SearchableItem, SearchSource} from '@astryxdesign/core/Typeahead'; const users: SearchableItem[] = [ {id: '1', label: 'Alice Johnson'}, {id: '2', label: 'Bob Smith'}, {id: '3', label: 'Charlie Brown'}, {id: '4', label: 'Diana Prince'}, {id: '5', label: 'Eve Williams'}, {id: '6', label: 'Frank Miller'}, ]; const userSource: SearchSource = { search: (query: string) => users.filter(u => u.label.toLowerCase().includes(query.toLowerCase())), bootstrap: () => users, }; export default function TokenizerOverflow() { const [inlineValue, setInlineValue] = useState(users); const [layerValue, setLayerValue] = useState(users); return (
Inline overflow — content shifts down on expand setInlineValue(items)} tokenOverflowBehavior="unfocusedInline" /> Layer overflow — expands as overlay, no layout shift setLayerValue(items)} tokenOverflowBehavior="unfocusedLayer" />
); }