Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS]: Listbox / Combobox anchor max height #3217

Open
pablocdev opened this issue May 20, 2024 · 4 comments
Open

[DOCS]: Listbox / Combobox anchor max height #3217

pablocdev opened this issue May 20, 2024 · 4 comments

Comments

@pablocdev
Copy link

Hi!

I have not found in the documentation a way to limit the max height of the options container, for both the listbox and the combobox components.

Using the developer tools, I discovered the --anchor-max-height variable without a value, and tried to use it the same as the --anchor-gap variable and... it works!

image

I think it would be a good idea to include this in the documentation for both components.

Thanks in advance

@pablocdev pablocdev changed the title [DOCS]: Listbox / Combobox anchor max width [DOCS]: Listbox / Combobox anchor max height May 20, 2024
@scajal
Copy link

scajal commented Jul 5, 2024

This is working, but I'm having an issue with the position of the options. If I limit the anchor height, the div just moves up its position (the top property changes) instead of scrolling (when using the mouse scroll).

@scajal
Copy link

scajal commented Jul 5, 2024

This is working, but I'm having an issue with the position of the options. If I limit the anchor height, the div just moves up its position (the top property changes) instead of scrolling (when using the mouse scroll).

Fixed it by removing the anchor property, setting portal to false and managing the position of the div myself.

@0xernesto
Copy link

0xernesto commented Sep 5, 2024

Using the developer tools, I discovered the --anchor-max-height variable without a value, and tried to use it the same as the --anchor-gap variable and... it works!

image

Thanks for pointing this out. I spent way too much time trying to figure this out. Here is what I ended up doing:

<ListboxOptions
            anchor={{
              to: "bottom end",
              gap: 8,
              offset: 0,
              padding: 0,
            }}
            className="z-50 w-fit overflow-auto rounded-lg p-1 text-sm outline-none [--anchor-max-height:15rem]"
          >

@scajal
Copy link

scajal commented Sep 5, 2024

Using the developer tools, I discovered the --anchor-max-height variable without a value, and tried to use it the same as the --anchor-gap variable and... it works!
image

Thanks for pointing this out. I spent way too much time trying to figure this out. Here is what I ended up doing:

<ListboxOptions
            anchor={{
              to: "bottom end",
              gap: 8,
              offset: 0,
              padding: 0,
            }}
            className="z-50 w-fit overflow-auto rounded-lg p-1 text-sm outline-none [--anchor-max-height:15rem]"
          >

Thanks @0xernesto. I finally solved it using the following for the height:

<ListboxOptions
    portal={false}
    anchor="bottom"
    className="!max-h-72 (...rest of classes)"
>

hyoban added a commit to RSSNext/Follow that referenced this issue Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants