prosekit/web/autocomplete
Anatomy
Section titled “Anatomy”Classes
Section titled “Classes”SelectEvent
Section titled “SelectEvent”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new SelectEvent():SelectEvent
ValueChangeEvent
Section titled “ValueChangeEvent”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new ValueChangeEvent(value:string):ValueChangeEvent
Properties
Section titled “Properties”-
readonly detail:string -
The newly selected value.
ValuesChangeEvent
Section titled “ValuesChangeEvent”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new ValuesChangeEvent(values:string[]):ValuesChangeEvent
Properties
Section titled “Properties”-
readonly detail:string[] -
The newly selected values.
OpenChangeEvent
Section titled “OpenChangeEvent”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new OpenChangeEvent(open:boolean):OpenChangeEvent
Properties
Section titled “Properties”-
readonly detail:boolean -
Whether the overlay is open.
AutocompleteEmptyElement
Section titled “AutocompleteEmptyElement”<prosekit-autocomplete-empty> custom element.
Properties: AutocompleteEmptyProps
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
AutocompleteItemElement
Section titled “AutocompleteItemElement”<prosekit-autocomplete-item> custom element.
Properties: AutocompleteItemProps
Events: AutocompleteItemEvents
Data attributes:
| Attribute | Description |
|---|---|
data-highlighted | Present when the item is the currently highlighted option |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
disabled:boolean -
Whether this option is disabled.
Default
Section titled “Default”false
-
value:string -
The value of the item, which will be matched against the query.
If not provided, the value is the item's text content.
Default
Section titled “Default”""
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
AutocompletePopupElement
Section titled “AutocompletePopupElement”<prosekit-autocomplete-popup> custom element.
Properties: AutocompletePopupProps
Events: AutocompletePopupEvents
Data attributes:
| Attribute | Description |
|---|---|
data-state | "open" when the autocomplete is visible, "closed" otherwise |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
AutocompletePositionerElement
Section titled “AutocompletePositionerElement”<prosekit-autocomplete-positioner> custom element.
Properties: AutocompletePositionerProps
Data attributes:
| Attribute | Description |
|---|---|
data-state | "open" when the autocomplete is visible, "closed" otherwise |
data-side | The side of the anchor element the positioner is on |
data-align | The alignment of the positioner relative to the anchor element |
CSS variables:
| Variable | Description |
|---|---|
--transform-origin | The coordinates that this element is anchored to. Useful for scale animations. |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
strategy:"fixed"|"absolute" -
The strategy to use for positioning
Default
Section titled “Default”"absolute"
-
autoUpdate:boolean|AutoUpdateOptions -
Options to activate auto-update listeners
https://floating-ui.com/docs/autoUpdate
Default
Section titled “Default”true
-
flip:boolean|Placement[] -
Whether to flip the
placementin order to keep it in view when the preferred placement(s) will overflow the clipping boundary. You can also provide an array of placements to try sequentially if the preferredplacementdoes not fit.Default
Section titled “Default”true
-
shift:boolean -
Whether the floating element should shift to keep it in view.
Default
Section titled “Default”true
-
overlap:boolean -
Whether the floating element can overlap the reference element to keep it in view.
Default
Section titled “Default”false
-
sameWidth:boolean -
Whether to constrain the floating element's width so that it matches the reference element.
Default
Section titled “Default”false
-
sameHeight:boolean -
Whether to constrain the floating element's height so that it matches the reference element.
Default
Section titled “Default”false
-
hide:boolean -
Whether to hide the floating element when the reference element or the floating element is fully clipped.
Default
Section titled “Default”false
-
rootBoundary:RootBoundary -
Describes the root boundary that the element will be checked for overflow relative to. Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
Default
Section titled “Default”'viewport'
-
elementContext:ElementContext -
The element that will be used to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#elementcontext for more information.
Default
Section titled “Default”'floating'
-
altBoundary:boolean -
Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.
Default
Section titled “Default”false
-
placement:Placement -
The placement of the popover, relative to the text cursor.
Default
Section titled “Default”"bottom-start"
-
offset:OffsetOptions -
The distance between the popover and the hovered block.
Default
Section titled “Default”4
-
inline:boolean -
Default
Section titled “Default”true
-
hoist:boolean -
Default
Section titled “Default”true
-
fitViewport:boolean -
Default
Section titled “Default”true
-
boundary:Boundary -
Default
Section titled “Default”
-
overflowPadding:number -
Default
Section titled “Default”8
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
QueryChangeEvent
Section titled “QueryChangeEvent”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”-
new QueryChangeEvent(query:string):QueryChangeEvent
Properties
Section titled “Properties”-
readonly detail:string -
The current query string.
AutocompleteRootElement
Section titled “AutocompleteRootElement”<prosekit-autocomplete-root> custom element.
Properties: AutocompleteRootProps
Events: AutocompleteRootEvents
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”Properties
Section titled “Properties”-
The regular expression to match the query text to autocomplete.
Default
Section titled “Default”null
-
filter:ItemFilter|null -
The filter function to determine if an item should be shown in the listbox.
Default
Section titled “Default”defaultItemFilter
Methods
Section titled “Methods”-
addController(controller:ReactiveController):void
-
removeController(controller:ReactiveController):void
-
connectedCallback():void
-
disconnectedCallback():void
Interfaces
Section titled “Interfaces”AutocompleteEmptyProps
Section titled “AutocompleteEmptyProps”AutocompleteItemProps
Section titled “AutocompleteItemProps”Properties
Section titled “Properties”-
disabled:boolean -
Whether this option is disabled.
Default
Section titled “Default”false
-
value:string -
The value of the item, which will be matched against the query.
If not provided, the value is the item's text content.
Default
Section titled “Default”""
AutocompleteItemEvents
Section titled “AutocompleteItemEvents”Properties
Section titled “Properties”-
Emitted when the the item is selected.
AutocompletePopupProps
Section titled “AutocompletePopupProps”AutocompletePopupEvents
Section titled “AutocompletePopupEvents”Properties
Section titled “Properties”-
Emitted when the selected value changes. Only available when multiple is false.
-
Emitted when the selected values change. Only available when multiple is true.
AutocompletePositionerProps
Section titled “AutocompletePositionerProps”Properties
Section titled “Properties”-
strategy:"fixed"|"absolute" -
The strategy to use for positioning
Default
Section titled “Default”"absolute"
-
autoUpdate:boolean|AutoUpdateOptions -
Options to activate auto-update listeners
https://floating-ui.com/docs/autoUpdate
Default
Section titled “Default”true
-
flip:boolean|Placement[] -
Whether to flip the
placementin order to keep it in view when the preferred placement(s) will overflow the clipping boundary. You can also provide an array of placements to try sequentially if the preferredplacementdoes not fit.Default
Section titled “Default”true
-
shift:boolean -
Whether the floating element should shift to keep it in view.
Default
Section titled “Default”true
-
overlap:boolean -
Whether the floating element can overlap the reference element to keep it in view.
Default
Section titled “Default”false
-
sameWidth:boolean -
Whether to constrain the floating element's width so that it matches the reference element.
Default
Section titled “Default”false
-
sameHeight:boolean -
Whether to constrain the floating element's height so that it matches the reference element.
Default
Section titled “Default”false
-
hide:boolean -
Whether to hide the floating element when the reference element or the floating element is fully clipped.
Default
Section titled “Default”false
-
rootBoundary:RootBoundary -
Describes the root boundary that the element will be checked for overflow relative to. Please see https://floating-ui.com/docs/detectoverflow#rootboundary for more information.
Default
Section titled “Default”'viewport'
-
elementContext:ElementContext -
The element that will be used to check for overflow. Please see https://floating-ui.com/docs/detectoverflow#elementcontext for more information.
Default
Section titled “Default”'floating'
-
altBoundary:boolean -
Whether to check the alternate elementContext's boundary. Please see https://floating-ui.com/docs/detectoverflow#altboundary for more information.
Default
Section titled “Default”false
-
placement:Placement -
The placement of the popover, relative to the text cursor.
Default
Section titled “Default”"bottom-start"
-
offset:OffsetOptions -
The distance between the popover and the hovered block.
Default
Section titled “Default”4
-
inline:boolean -
Default
Section titled “Default”true
-
hoist:boolean -
Default
Section titled “Default”true
-
fitViewport:boolean -
Default
Section titled “Default”true
-
boundary:Boundary -
Default
Section titled “Default”
-
overflowPadding:number -
Default
Section titled “Default”8
AutocompleteRootProps
Section titled “AutocompleteRootProps”Properties
Section titled “Properties”-
The regular expression to match the query text to autocomplete.
Default
Section titled “Default”null
-
filter:ItemFilter|null -
The filter function to determine if an item should be shown in the listbox.
Default
Section titled “Default”defaultItemFilter
AutocompleteRootEvents
Section titled “AutocompleteRootEvents”Properties
Section titled “Properties”-
Emitted when the selected value changes. Only available when multiple is false.
-
Emitted when the selected values change. Only available when multiple is true.
-
Fired when the open state changes.
-
Fired when the query changes.