Accueil
Components
ListItem
ListItem
Permet d’afficher les données d’une ressource.
Il est recommandé d’utiliser les
ListItem
au sein d’une
ResourceList
plutôt que de manière isolée.
Examples
Styles
ui
Figma
Ouvrir Figma
(s'ouvre dans un nouvel onglet)
Default
Titre
Description
tsx
Copier
export
const
Default
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
)
;
WithTrailing
Titre
Description
tsx
Copier
export
const
WithTrailing
=
(
)
=>
(
<
ListItem
title
=
"Titre"
description
=
"Description"
trailing
=
{
(
)
=>
(
<
ButtonIcon
variant
=
"
tertiary
"
icon
=
"
CircleX
"
accessibilityLabel
=
"
Retirer
"
onPress
=
{
(
)
=>
console
.
log
(
'remove'
)
}
/>
)
}
Afficher tout
WithLoading
Le spinner remplace l'icône de trailing et s'affiche immédiatement (pas de délai) car le chargement porte sur l'item lui-même, pas sur une action utilisateur déclenchée par un bouton.
Titre
Description
tsx
Copier
export
const
WithLoading
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
loading
=
{
true
}
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
)
;
WithoutSeparator
Titre
Description
tsx
Copier
export
const
WithoutSeparator
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
showSeparateur
=
{
false
}
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
)
;
WithIcon
Titre
Description
tsx
Copier
export
const
WithIcon
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
IconProps
=
{
{
name
:
'Settings'
,
color
:
'primary'
}
}
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
)
;
WithAvatar
JP
Titre
Description
tsx
Copier
export
const
WithAvatar
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
AvatarProps
=
{
{
fallbackText
:
'Jean Pierre'
,
src
:
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400'
,
}
}
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
Afficher tout
WithPreviewImage
Titre
Description
tsx
Copier
export
const
WithPreviewImage
=
(
)
=>
(
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
preview_url
=
"
https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=400
"
onPress
=
{
(
)
=>
{
window
.
alert
(
'click !'
)
;
}
}
/>
)
;
ItemRadio
Titre
Description
tsx
Copier
export
const
ItemRadio
=
(
)
=>
{
const
[
value
,
setValue
]
=
useState
<
string
>
(
)
;
return
(
<
ListItem
title
=
"Titre"
description
=
"Description"
RadioProps
=
{
{
value
:
'tutu'
,
checked
:
value
===
'tutu'
,
onChange
:
v
=>
setValue
(
v
)
,
}
}
Afficher tout
ItemRadioMultiple
Titre
Description
tsx
Copier
export
const
ItemRadioMultiple
=
(
)
=>
{
const
[
value
,
setValue
]
=
useState
<
string
>
(
)
;
return
(
<
ListItem
title
=
"Titre"
description
=
"Description"
RadioProps
=
{
{
value
:
'tutu'
,
checked
:
value
===
'tutu'
,
onChange
:
v
=>
setValue
(
v
)
,
multiple
:
true
,
Afficher tout
ItemRadioWithIcon
Titre
Description
tsx
Copier
export
const
ItemRadioWithIcon
=
(
)
=>
{
const
[
value
,
setValue
]
=
useState
<
string
>
(
)
;
return
(
<
ListItem
title
=
"Titre"
description
=
"Description"
IconProps
=
{
{
name
:
'Settings'
}
}
RadioProps
=
{
{
value
:
'tutu'
,
checked
:
value
===
'tutu'
,
onChange
:
v
=>
setValue
(
v
)
,
Afficher tout
withoutHover
Sans prop
onPress
, l’effet de hover n’apparaît pas.
Titre
Description
tsx
Copier
export
const
withoutHover
=
(
)
=>
<
ListItem
title
=
"
Titre
"
description
=
"
Description
"
/>
;