Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [view-components]

The tag has no usage guidance.

view-components
1 vote
1 answer
31 views

How can I make Tailwind work on my component

Good morning everyone. I'm trying to render a FlashMessage component <% flash.each do |type, message| %> <%= render FlashMessageComponent.new(type: type, message: message) %&...
Ritchie Matos's user avatar
0 votes
0 answers
48 views

Rails: problem with handle redirect with turbo_stream in apps

In the application, when creating a feature, it was necessary to add hotwired/turbo-rails. // app/javascript/application.js import "@hotwired/turbo-rails" import "controllers" ...
Steven's user avatar
  • 13
0 votes
1 answer
23 views

razor library loading views from different location

My app implements plugin system (razor libraries). App is using razor runtime compilation. Razor library contains few ViewComponents with custom structure described below. Razor library structure: ...
luve's user avatar
  • 1
1 vote
1 answer
382 views

Rails Hotwire and ViewComponents: turbo frames not replacing content

We are currently in the process of moving over our app from Vue.js to hotwire. We are just experiencing a very weird bug when using turbo_frames and ViewComponents. We have a turbo_frame_tag for a ...
Brandon Teixeira's user avatar
1 vote
2 answers
151 views

Flash message view component rendering :type as a :message?

I have followed this post https://reinteractive.com/articles/how-to-create-flash-messages-in-Rails-7 to add nice flash messages with tailwind, which got me into View Components. Everything works apart ...
Luke Littler's user avatar
1 vote
1 answer
123 views

Errors are being swallowed inside ViewComponent, Ruby on Rails

Hoping you're having a good day. So, i have this weird bug that's been kicking my ass and i'm not sure where it is located for the love of God. I have a ViewComponent that is rendered normally inside ...
Ahmed Khattab's user avatar
0 votes
0 answers
40 views

How can a local variable passed to a rendered partial be passed to a ViewComponent in the partial as an argument, without being explicitly passed?

If a partial is rendered, and receives 2 local variables "name" and "environment": # arbitrary show view <%= render partial: "sports_team/details_and_performance", ...
J.R. Bob Dobbs's user avatar
1 vote
2 answers
100 views

Specifying Paths for View Components in a Gem Utilizing Tailwind CSS in `tailwind.config.js`

I'm developing a gem that acts as a library of view components integrated with Tailwind CSS. In this project, there's a crucial tailwind.config.js file where I specify the paths for building the tags ...
Arthur Felipe's user avatar
0 votes
0 answers
72 views

What does the `#with_items` method do for a ViewComponent?

I'm editing a feature that renders a ViewComponent. After the ViewComponent is rendered, it's passed a block, which is the component itself render SomeComponent.new(arg: foo) do |component| ...
J.R. Bob Dobbs's user avatar
0 votes
1 answer
29 views

Problem with rendering in view_componets in rails

This is the situation in view components: app/components/appointments/new_appointment_component.haml = form_with(model: @appointment, url: appointments_path, method: :post) do |f| = f.hidden_field :...
Steven's user avatar
  • 13
0 votes
1 answer
156 views

How to test View Component routes

I have a card component that when clicked, takes you to a different route in the application. The component is built using Rails ViewComponents. What is the best way to write tests that ensure when a ...
user avatar
1 vote
1 answer
519 views

Rendering template dynamically in Rails ViewComponent

I have a SectionComponent Class as follow : class SectionComponent < ViewComponent::Base def initialize(..) ... end end And a matching section_component.html.erb file. It works perfectly ...
Maxence's user avatar
  • 2,249
0 votes
1 answer
269 views

In ruby View Components, is possible to access parent translation from child?

I am using view component in rails project. I want use translation from my parent inside a child. For now, I have this: components └─ a ├─ component.rb ├─ component.html.erb ├─ component.yml ...
jpheos's user avatar
  • 458
0 votes
0 answers
31 views

Multiple View Components in a hybrid Controller

Is it possible to have more than one view component in an asp.net core Hybrid controller, like child actions in .Net framework MVC? and if yes what naming can they have?
mz1378's user avatar
  • 2,440
1 vote
1 answer
217 views

Rails URL Generation in ViewComponent Previews

I have a component that uses slots, which I managed to figure out how to render in a preview. I know that in a test environment, it's possible to use with_request_url to specify a particular request ...
crespire's user avatar

15 30 50 per page