MCPcopy Create free account
hub / github.com/react-component/select / getBuiltInPlacements

Function getBuiltInPlacements

src/SelectTrigger.tsx:7–50  ·  view source on GitHub ↗
(
  dropdownMatchSelectWidth: number | boolean,
)

Source from the content-addressed store, hash-verified

5import type { Placement, RenderDOMFunc } from './BaseSelect';
6
7const getBuiltInPlacements = (
8 dropdownMatchSelectWidth: number | boolean,
9): Record<string, AlignType> => {
10 // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided
11 const adjustX = dropdownMatchSelectWidth === true ? 0 : 1;
12 return {
13 bottomLeft: {
14 points: ['tl', 'bl'],
15 offset: [0, 4],
16 overflow: {
17 adjustX,
18 adjustY: 1,
19 },
20 htmlRegion: 'scroll',
21 },
22 bottomRight: {
23 points: ['tr', 'br'],
24 offset: [0, 4],
25 overflow: {
26 adjustX,
27 adjustY: 1,
28 },
29 htmlRegion: 'scroll',
30 },
31 topLeft: {
32 points: ['bl', 'tl'],
33 offset: [0, -4],
34 overflow: {
35 adjustX,
36 adjustY: 1,
37 },
38 htmlRegion: 'scroll',
39 },
40 topRight: {
41 points: ['br', 'tr'],
42 offset: [0, -4],
43 overflow: {
44 adjustX,
45 adjustY: 1,
46 },
47 htmlRegion: 'scroll',
48 },
49 };
50};
51
52export interface RefTriggerProps {
53 getPopupElement: () => HTMLDivElement;

Callers 1

SelectTriggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…