> ## Documentation Index
> Fetch the complete documentation index at: https://neo.tvk.company/llms.txt
> Use this file to discover all available pages before exploring further.

# Skeleton

> Turns its content into a loading skeleton, then reveals the content when loading ends.

> [!NOTE]
>
> Pass mock data as the child while `isLoading` is `true`. The skeleton draws bones from what that child paints, so an empty child has no bones. When the content loads again, pass the previous data as the mock so the shape stays the same.

## Examples

> [tab] Basic Usage
>
> ```dart Card Content lines theme={null}
> NeoCard(
>   child: NeoSkeleton(
>     isLoading: isLoading.value, // Using hooks
>     child: Row(
>       children: [
>         Expanded(
>           child: Column(
>             crossAxisAlignment: .start,
>             children: [
>               Text(
>                 "Alex van Dijk",
>                 style: theme.textStyles.label.copyWith(
>                   color: theme.colors.fgPrimary,
>                 ),
>               ),
>               Text(
>                 "Night shift, west wing",
>                 style: theme.textStyles.body2.copyWith(
>                   color: theme.colors.fgSecondary,
>                 ),
>               ),
>             ],
>           ),
>         ),
>         NeoButton(
>           variant: .secondary,
>           size: .small,
>           label: "Message",
>           onPressed: () {},
>         ),
>       ],
>     ),
>   ),
> ),
> ```

> [tab] Mock Data
>
> ```dart Previous Data on Reload lines theme={null}
> NeoSkeleton(
>   isLoading: isLoading.value, // Using hooks
>   child: Column(
>     crossAxisAlignment: .start,
>     children: [
>       Text(
>         isLoading.value ? previousName.value : name.value,
>         style: theme.textStyles.label.copyWith(
>           color: theme.colors.fgPrimary,
>         ),
>       ),
>       Text(
>         isLoading.value ? previousDetail.value : detail.value,
>         style: theme.textStyles.body2.copyWith(
>           color: theme.colors.fgSecondary,
>         ),
>       ),
>     ],
>   ),
> ),
> ```

> [tab] Keep and Bone
>
> ```dart Bone lines theme={null}
> NeoSkeleton.bone(
>   child: Container(
>     width: 36,
>     height: 36,
>     alignment: .center,
>     decoration: BoxDecoration(
>       color: theme.colors.bgTertiary,
>       shape: .circle,
>     ),
>     child: Text(
>       "AL",
>       style: theme.textStyles.label.copyWith(
>         color: theme.colors.fgPrimary,
>       ),
>     ),
>   ),
> ),
> ```
>
> ```dart Keep lines theme={null}
> NeoSkeleton.keep(
>   child: Text(
>     "Shift details",
>     style: theme.textStyles.label.copyWith(
>       color: theme.colors.fgPrimary,
>     ),
>   ),
> ),
> ```

> [tab] Changing Size
>
> ```dart Ease to the New Size lines theme={null}
> NeoCard(
>   child: AnimatedSize(
>     duration: theme.durations.long,
>     curve: Curves.easeOutExpo,
>     alignment: .topLeft,
>     child: NeoSkeleton(
>       isLoading: isLoading.value, // Using hooks
>       child: Text(
>         description.value,
>         style: theme.textStyles.body2.copyWith(
>           color: theme.colors.fgSecondary,
>         ),
>       ),
>     ),
>   ),
> ),
> ```

## Properties

### Required

**child** `Widget` *required*

The content. While `isLoading` is `true`, pass mock data here. The skeleton draws bones from what this child paints, so an empty child has no bones.

### State

**isLoading** `bool` (default: false)

Whether to show the skeleton. Set it to `false` to reveal the content.

## Constructors

`NeoSkeleton.keep` and `NeoSkeleton.bone` mark a part inside a `NeoSkeleton`. Outside a skeleton they show their child as it is.

### NeoSkeleton.keep()

Shows a part as it is while the skeleton loads. A kept part stays live, so it takes taps and a screen reader can reach it.

**child** `Widget` *required*

The part to keep.

### NeoSkeleton.bone()

Turns a part into one bone in its own shape, such as an avatar with initials.

**child** `Widget` *required*

The part to turn into one bone.

## What Becomes a Bone

* Each line of text becomes a bar.
* Icons and images become rounded blocks.
* Shapes with nothing inside, such as a filled circle, become bones in their own shape.
* A surface with content inside, such as a [`NeoCard`](https://neo.tvk.company/widgets/utilities/card), keeps its look.
* [`NeoButton`](https://neo.tvk.company/widgets/buttons/button), [`NeoDivider`](https://neo.tvk.company/widgets/utilities/divider), and [`NeoTabBar`](https://neo.tvk.company/widgets/navigation/tab-bar) stay as they are.
* [`NeoBadge`](https://neo.tvk.company/widgets/utilities/badge), [`NeoToggleSwitch`](https://neo.tvk.company/widgets/controls/toggle-switch), [`NeoCheckbox`](https://neo.tvk.company/widgets/inputs/checkbox), and [`NeoFluidCounter`](https://neo.tvk.company/widgets/utilities/fluid-counter) each become one bone.
* `NeoSkeleton.keep` and `NeoSkeleton.bone` take precedence over these defaults.

## Best Practices

* Pass mock data while loading. An empty child draws no bones.
* When the content loads again, pass the previous data as the mock so the shape stays the same.
* Put the skeleton in an `AnimatedSize` when the loaded content can have a different size.

## Behavior

* While loading, the bones shimmer. With reduced motion, they stay still and the content appears without a sweep.
* When loading ends, the content arrives behind a sweep from the top-left. Skeletons that finish in the same frame share one sweep.
* The skeleton always takes the size of its child, so content of a different size changes the box at once.
* While loading, only kept parts take taps. A screen reader hears "Loading" once, plus the kept parts.
* The skeleton records its child again when the child widget changes, when the theme changes, and on hot reload. An animation inside it is recorded again at most every 250 ms.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.