Skip to main content

width

Description

Optional. Sets the width of a dropdown

Usage

width?: string;

Default value

"100%"

Example

import { useState } from "react";
import { Dropdown, Calendar, Text } from "@svar-ui/react-core";

export default function Example() {
const [popup, setPopup] = useState(false);

function oncancel() {
setPopup(false);
}

return (
<>
<div onClick={() => setPopup(true)}>
<Text />
</div>

{popup && (
<Dropdown onCancel={oncancel} width="300px">
<Calendar value={new Date(2023, 2, 15)} />
</Dropdown>
)}
</>
);
}

Details

This property corresponds to the width CSS property and can take all its values set as strings.

Related article: Setting the width of Dropdown