Skip to content

More options for placement #6

@eduardo-santos-carvalho

Description

@eduardo-santos-carvalho

Hello! I'm starting to use your color picker in a project and I'd like to suggest an improvement.

Currently, when configuring dialogPlacement, it's only possible to set the options top, left, right, or bottom, which causes the picker dialog to be centered in one of those positions.

In most cases, this works very well. However, I felt the need to be able to set something like bottom-left in some specific scenarios.

I tried to work around this using headless mode, but it ended up being more complex than I expected.

Here's a screenshot for reference of the expected result.

How is now:
Image

How would be bottom-left:
Image

Config in JS:

const picker = new ColorPicker('#input_color', {
    color: '#242424',
    swatchesOnly: false,
    enableAlpha: true,
    formats: ['hex', 'rgb', 'hsl', 'hsv'],
    defaultFormat: 'hex',
    submitMode: 'instant',
    showClearButton: false,
    dismissOnOutsideClick: true,
    dismissOnEscape: false,
    enableEyedropper: true,
    dialogPlacement: 'bottom left'
});```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions