# chilp
[](https://hex.pm/packages/chilp)
[](https://hexdocs.pm/chilp/)
```sh
gleam add chilp@1
```
## Examples
- [lustre_chilp_app](https://forge.strawmelonjuice.com/strawmelonjuice/chilp/src/branch/main/examples/lustre_chilp_app)
- [lustre_chilp_app_nocomponent](https://forge.strawmelonjuice.com/strawmelonjuice/chilp/src/branch/main/examples/lustre_chilp_app_nocomponent)
Further documentation can be found at <https://hexdocs.pm/chilp>.
## Styling
When using `chilp.widget()`, CSS to style it is automatically embedded. To say no to that use `widget.element` or create your own widget from `chilp/widget/base`!
That said,
```gleam
io.print(widget.css)
```
Yields you:
```css
.chilp-widget {
--highlight: #595aff;
transition: all 0.5s ease;
overflow: hidden;
::selection {
background-color: rgba(89, 90, 255, 0.2);
color: var(--highlight);
}
.widget::-webkit-scrollbar {
width: 6px;
}
.widget::-webkit-scrollbar-thumb {
background-color: #e2e8f0;
border-radius: 10px;
}
.widget {
max-width: 600px;
margin: 2rem auto;
background-color: floralwhite;
font-family: sans-serif;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.widget > .btn-get-comments {
display: block;
width: 100%;
max-width: 200px;
margin: 2rem auto 0 auto;
padding: 12px 24px;
background-color: transparent;
color: #595aff;
border: 2px solid #595aff;
border-radius: 8px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease-in-out;
}
.widget > .btn-get-comments:hover {
background-color: #595aff;
color: white;
box-shadow: 0 4px 12px rgba(89, 90, 255, 0.3);
transform: translateY(-1px);
}
h1.widget-header {
font-size: 1.75rem;
font-weight: 800;
color: #1a202c;
margin: 0 0 0.5rem 0;
letter-spacing: -0.025em;
}
.subheader {
font-size: 0.95rem;
color: #718096;
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 6px;
}
.post-link {
color: #595aff;
text-decoration: none;
font-weight: 500;
border-bottom: 1px solid transparent;
transition: border-color 0.2s;
}
.post-link:hover {
border-bottom-color: #595aff;
}
.or-create-an-account-disclaimer {
font-size: 0.73rem;
color: #a0aec0;
margin: -4px 0 12px 2px;
font-style: italic;
margin-bottom: 1.5rem;
display: flex;
align-items: center;
gap: 6px;
}
.go-reply-form {
display: flex;
gap: 0;
border-bottom: 1px solid #edf2f7;
padding-bottom: 1.5rem;
margin-bottom: 2rem;
max-width: 500px;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.go-reply-form-input {
flex: 1;
padding: 10px 15px;
border: 2px solid #e2e8f0;
flex: 1;
border-right: none;
border-radius: 8px 0 0 8px;
font-size: 0.95rem;
outline: none;
transition: border-color 0.2s;
}
.go-reply-form-input:focus {
border-color: var(--highlight);
}
.go-reply-form-input::placeholder {
color: #a0aec0;
}
.input-group {
display: flex;
flex-direction: column;
width: 100%;
gap: 6px;
}
.go-reply-label {
font-size: 0.85rem;
font-weight: 600;
color: #4a5568;
letter-spacing: 0.05em;
margin-left: 2px;
}
.form-controls {
display: flex;
width: 100%;
}
.go-reply-form-button {
padding: 10px 20px;
border: 2px solid var(--highlight);
border-radius: 0 8px 8px 0;
background-color: var(--highlight);
color: white;
font-weight: 600;
cursor: pointer;
transition: all 0.2s;
white-space: nowrap;
}
.go-reply-form-button:hover {
background-color: var(--highlight);
border-color: var(--highlight);
}
@media (max-width: 480px) {
.go-reply-form {
flex-direction: column;
gap: 8px;
}
.go-reply-form-input,
.go-reply-form-button {
border-radius: 8px;
border: 2px solid #e2e8f0;
}
}
.comment-widget form {
display: flex;
gap: 10px;
margin-bottom: 1.5rem;
}
.comment-widget input[name="userinstance"] {
flex-grow: 1;
padding: 8px 12px;
border: 1px solid #ccc;
border-radius: 4px;
}
.comment {
border-left: 2px solid #eee;
padding-left: 1rem;
margin-top: 1.5rem;
display: flex;
flex-direction: column;
}
.comment header {
display: flex;
align-items: center;
gap: 12px;
margin-bottom: 8px;
}
.comment .avatar {
width: 36px;
height: 36px;
border-radius: 4px;
object-fit: cover;
background: #eee;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.comment .display-name {
font-weight: bold;
display: block;
}
.comment time {
font-size: 0.85rem;
color: #666;
}
.comment .content {
line-height: 1.5;
}
.comment .content p {
margin: 0.5rem 0;
}
.comment .mention {
color: var(--highlight);
text-decoration: none;
}
.comment footer {
margin-top: 8px;
}
.comment footer a {
font-size: 0.8rem;
color: #888;
text-decoration: none;
}
.comment footer a:hover {
text-decoration: underline;
}
.comment .comment {
margin-left: 10px;
border-left: 2px solid #ddd;
}
.error {
color: red;
font-size: smaller;
}
}
```
## Development
```sh
cd examples/lustre_chilp_app
gleam run -m lustre/dev start
```