Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Without passing it anything you'll get very basic styles, however giving it it's

![Nuget](https://img.shields.io/nuget/v/TailBlazor.List.svg)

> **Note:** Starting with version 2.0.0, the component targets .NET 9 and uses Blazor's interactive auto render mode so it can seamlessly participate in either server-side or client-side rendering.

![Demo](screenshot.png)

## Getting Setup
Expand Down
37 changes: 19 additions & 18 deletions src/TailBlazor.List/TailBlazor.List.csproj
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<PackageId>TailBlazor.List</PackageId>
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RazorLangVersion>9.0</RazorLangVersion>
<PackageId>TailBlazor.List</PackageId>
<RootNamespace>TailBlazor.List</RootNamespace>
<Version>1.0.3</Version>
<Version>2.0.0</Version>
<Authors>Taylor Watson</Authors>
<IsPackage>true</IsPackage>
<PackageTags>Blazor; TailBlazorcss; TailBlazor css; tailwind; tailwindcss; List; Lists;</PackageTags>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/TailBlazor/List</PackageProjectUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/TailBlazor/List</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/TailBlazor/List</RepositoryUrl>
<Description>
A Blazor list component based off TailWindCss. It has the bare minimum styles to function with the option to add your own classes. It's built so it can be fully customizable and reusable for any list type.
</Description>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<PackageIcon>logo.png</PackageIcon>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<PackageIcon>logo.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="5.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0-preview.4.24267.6" />
</ItemGroup>

<ItemGroup>
<None Include="../../logo.png" Pack="true" PackagePath="">
Expand Down
10 changes: 7 additions & 3 deletions src/TailBlazor.List/TailBlazorList.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
@namespace TailBlazor.List
@attribute [RenderModeInteractiveAuto]
Comment on lines 1 to +2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Remove unconditional RenderModeInteractiveAuto attribute

Applying @attribute [RenderModeInteractiveAuto] in the component library forces every consuming app to configure Blazor’s interactive auto render mode. Existing Blazor Server/WebAssembly apps that simply reference this component but have not registered interactive auto services will now throw InvalidOperationException at runtime because the render mode is unsupported. The list component previously worked in any app; after this change it crashes unless the host uses SSR with interactive auto. Consider leaving render mode decisions to the host or making this opt‑in so the package remains compatible with non‑SSR projects.

Useful? React with 👍 / 👎.

@typeparam TItem

<ul class="@Class">
@foreach (var listItem in Items)
@foreach (var listItem in ResolvedItems)
{
<li>
@ChildContent(listItem)
@if (ChildContent is not null)
{
@ChildContent(listItem)
}
</li>
}
</ul>
</ul>
9 changes: 6 additions & 3 deletions src/TailBlazor.List/TailBlazorList.razor.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Components;

namespace TailBlazor.List
{
public partial class TailBlazorList<TItem>
{
[Parameter]
public RenderFragment<TItem> ChildContent { get; set; }
[Parameter, EditorRequired]
public RenderFragment<TItem>? ChildContent { get; set; }

[Parameter]
public IEnumerable<TItem> Items { get; set; }
public IEnumerable<TItem>? Items { get; set; }

[Parameter]
public string Class { get; set; } = "bg-white shadow-md overflow-hidden sm:rounded-md divide-y divide-gray-200";

protected IEnumerable<TItem> ResolvedItems => Items ?? Array.Empty<TItem>();
}
}
3 changes: 2 additions & 1 deletion src/TailBlazor.List/_Imports.razor
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web