Skip to Content
API ReferenceuseSitare

API Reference

useSitare(options?)

The useSitare hook accepts an optional configuration object.

Options

PropTypeDefaultDescription
defaultVisiblebooleanfalseInitial visibility state of the password.
icons{ show: ReactNode, hide: ReactNode }undefinedCustom icons for show/hide states.
disabledbooleanfalseWhether the input is disabled.
readOnlybooleanfalseWhether the input is read-only.
idstringundefinedID for the input element. If not provided, a random ID will be generated.
inputPropsReact.InputHTMLAttributesundefinedProps to be merged with the generated input props.
btnPropsReact.ButtonHTMLAttributesundefinedProps to be merged with the generated button props.

Returns

The hook returns an object with the following properties:

PropertyTypeDescription
inputPropsReact.InputHTMLAttributesProps for the input element.
btnPropsReact.ButtonHTMLAttributesProps for the toggle button.
isVisiblebooleanCurrent visibility state.
toggle() => voidFunction to toggle visibility.
setVisible(visible: boolean) => voidFunction to set visibility explicitly.

© 2026 Sitare. MIT License.

Created by Ömer Gülçiçek|GitHub