useCollectionPreferences
is a React hook for managing
CollectionPreferences
's state.
Type: any
optional
The default value of CollectionPreference
's preference
prop's custom
property
Type: number
optional
The default value of CollectionPreference
's preference
prop's pageSize
property
Type: string[]
optional
The default value of Table
's visibleColumns
prop and
CollectionPreference
's preference
prop's visibleContent
property
Type: boolean
optional
The default value of Table
's wrapLines
prop and CollectionPreference
's
preference
prop's wrapLines
property
Type: (pageSize?: number) => void
optional
onPageSizeChange
is an event listener that fires whenever the customer changes
the page size preference. It is passed the new page size.
Type: (visibleContent?: string[]) => void
optional
onVisibleContentChange
is an event listener that fires whenever the customer
changes the visible columns. It is passed an array containing the IDs of the
newly visible columns.
Type: (wrapLines?: boolean) => void
optional
onWrapLinesChange
is an event listener that fires whenever the customer
changes the wrap lines preference. It is passed a boolean indicating whether the
lines are to be wrapped.
CollectionPreferences
's preference
prop's custom
property
You may use this value in your components' logic, but you do not need to
pass it to the CollectionPreference
component. Use
preferences
to pass this value to CollectionPreferences
instead.
CollectionPreferences
's onConfirm
prop
CollectionPreferences
's preference
prop's pageSize
property
You may use this value in your components' logic, but you do not need to
pass it to the CollectionPreference
component. Use
preferences
to pass this value to CollectionPreferences
instead.
CollectionPreferences
's preferences
prop
CollectionPreferences
's preference
prop's visibleContent
property
You may use this value in your components' logic, but you do not need to
pass it to the CollectionPreference
component. Use
preferences
to pass this value to CollectionPreferences
instead.
CollectionPreferences
's preference
prop's wrapLines
property
You may use this value in your components' logic, but you do not need to
pass it to the CollectionPreference
component. Use
preferences
to pass this value to CollectionPreferences
instead.
import CollectionPreferences from '@awsui/components-react/collection-preferences';
import { useCollectionPreferences } from 'use-awsui';
export default function MyCollectionPreferences() {
const { handleConfirm, preferences } = useCollectionPreferences({
defaultPageSize: 20,
defaultVisibleContent: ['name', 'downloads'],
defaultWrapLines: false,
});
return (
<CollectionPreferences
onConfirm={handleConfirm}
preferences={preferences}
/>
);
}