# Action Buttons ## Example ```svelte

ActionButtons

toast('Reply clicked') }} repost={{ count: 42, onclick: () => toast('Repost clicked') }} like={{ count: likeCount, active: liked, onclick: () => { likeCount += liked ? -1 : 1; liked = !liked; } }} bookmark={{ active: bookmarked, onclick: () => { bookmarked = !bookmarked; } }} />

Individual Buttons

toast('Reply')} /> toast('Repost')} /> { likeCount2 += liked2 ? -1 : 1; liked2 = !liked2; }} /> { bookmarked2 = !bookmarked2; }} />
``` ## Documentation ## Usage ### ActionButtons Container ```svelte console.log('reply') }} repost={{ count: 12, onclick: () => console.log('repost') }} like={{ count: 99, active: liked, onclick: () => (liked = !liked) }} bookmark={{ active: bookmarked, onclick: () => (bookmarked = !bookmarked) }} /> ``` ### Individual Buttons Each button can be used standalone: ```svelte (liked = !liked)} /> ``` ### State Management The parent controls the state via `active` prop. The `onclick` callback handles toggling: ```svelte { await api.like(postId); liked = !liked; }} /> ``` ## API Reference ### ActionButtons Container for social action buttons (reply, repost, like, bookmark). | Prop | Type | Default | Description | |------|------|---------|-------------| | reply | `ReplyButtonProps` | `-` | Props for the reply button. Omit to hide. | | repost | `RepostButtonProps` | `-` | Props for the repost button. Omit to hide. | | like | `LikeButtonProps` | `-` | Props for the like button. Omit to hide. | | bookmark | `BookmarkButtonProps` | `-` | Props for the bookmark button. Omit to hide. | | customActions | `Snippet` | `-` | Additional custom action buttons. | | class | `string` | `-` | Additional CSS classes to apply. | ### ReplyButton A reply action button with count. | Prop | Type | Default | Description | |------|------|---------|-------------| | count | `number` | `-` | Number of replies to display. | | onclick | `() => void` | `-` | Callback when the reply button is clicked. | | href | `string` | `-` | URL for the reply action link. Used when onclick is not provided. | ### RepostButton A repost action button with count. | Prop | Type | Default | Description | |------|------|---------|-------------| | count | `number` | `-` | Number of reposts to display. | | active | `boolean` | `false` | Whether the post is reposted. (bindable) | | onclick | `() => void` | `-` | Callback when the repost button is clicked. | | href | `string` | `-` | URL for the repost action link. Used when onclick is not provided. | ### LikeButton A like toggle button with count. | Prop | Type | Default | Description | |------|------|---------|-------------| | count | `number` | `-` | Number of likes to display. | | active | `boolean` | `false` | Whether the post is liked. (bindable) | | onclick | `() => void` | `-` | Callback when the like button is clicked. | | href | `string` | `-` | URL for the like action link. Used when onclick is not provided. | ### BookmarkButton A bookmark toggle button. | Prop | Type | Default | Description | |------|------|---------|-------------| | active | `boolean` | `false` | Whether the post is bookmarked. (bindable) | | onclick | `() => void` | `-` | Callback when the bookmark button is clicked. |