Skip to content

[bug]: TypeError: Cannot read properties of undefined (reading 'Root') in SelectPrimitive #8537

@PrevinBogopa

Description

@PrevinBogopa

Describe the bug

When trying to import and use the SelectPrimitive component from bits-ui, I encountered the following error:

TypeError: Cannot read properties of undefined (reading 'Root')

This issue occurs when trying to access the Root property of SelectPrimitive. The error is triggered at the following line in my code:

const Root = SelectPrimitive.Root;

The SelectPrimitive object is undefined or doesn’t contain the Root property, causing the application to crash.

The error will occur, and the application will break with TypeError: Cannot read properties of undefined (reading 'Root').

    "bits-ui": "^2.11.8",
    "@sentry/sveltekit": "^10.20.0",
    "typescript": "^5.9.3",
    "typescript-eslint": "^8.46.1",
    "vite": "7.1.11",
Image Image

//index.ts
Image

Affected component/components

Select-group,Select,Select-Content etc.

How to reproduce

Steps to reproduce the behavior:
in index.ts

Import SelectPrimitive from bits-ui:

import { Select as SelectPrimitive } from "bits-ui";

Access the Root property:

const Root = SelectPrimitive.Root;

Image

Codesandbox/StackBlitz link

No response

Logs

System Info

I am Using Mac OS , browser: Google Chrome,

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions